MacOS Compiler Warnings, changes will be needed for LLVM-19
Hi Evan, I just built the 2025.1 on MacOS and saw some warnings from Apple's Clang-16 that you should at least be aware of. Not an issue right now though, thanks for the update!
These were MacOS build warnings when compiling Nedit-ng tag 2025.1-3-g61a960ea with a CXX Compiler "AppleClang 16.0.0.16000026". The resulting binary runs fine, but the warnings imply that some code changes will probably be needed for future Clang versions.
I'm only including one copy of each warning, most were emitted for multiple source files, some were for templates that are instantiated in more than one place.
In file included from /Users/anj/Software/other/nedit-ng/src/Highlight.h:5:
/Users/anj/Software/other/nedit-ng/src/TextBufferFwd.h:8:44: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it. [-Wdeprecated-declarations]
8 | template <class Ch = char, class Tr = std::char_traits<Ch>>
| ^
/Users/anj/Software/other/nedit-ng/src/TextBufferFwd.h:12:21: note: in instantiation of default argument for 'BasicTextBuffer<uint8_t>' required here
12 | using UTextBuffer = BasicTextBuffer<uint8_t>;
| ^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/__string/char_traits.h:81:8: note: 'char_traits<unsigned char>' has been explicitly marked deprecated here
81 | struct _LIBCPP_DEPRECATED_(
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/__config:996:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
996 | # define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))
| ^
In file included from /Users/anj/Software/other/nedit-ng/src/DialogSmartIndent.cpp:14:
/Users/anj/Software/other/nedit-ng/Util/include/Util/algorithm.h:57:37: warning: unused parameter 'array' [-Wunused-parameter]
57 | constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept {
| ^
In file included from /Users/anj/Software/other/nedit-ng/src/DocumentWidget.h:5:
In file included from /Users/anj/Software/other/nedit-ng/src/Bookmark.h:5:
In file included from /Users/anj/Software/other/nedit-ng/src/TextBuffer.h:8:
In file included from /Users/anj/Software/other/nedit-ng/src/gap_buffer.h:6:
/Users/anj/Software/other/nedit-ng/src/gap_buffer_fwd.h:7:44: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it. [-Wdeprecated-declarations]
7 | template <class Ch = char, class Tr = std::char_traits<Ch>>
| ^
/Users/anj/Software/other/nedit-ng/src/TextBuffer.h:229:2: note: in instantiation of default argument for 'gap_buffer<unsigned char>' required here
229 | gap_buffer<Ch> buffer_;
| ^~~~~~~~~~~~~~
/Users/anj/Software/other/nedit-ng/src/DocumentWidget.cpp:5689:44: note: in instantiation of template class 'BasicTextBuffer<unsigned char>' requested here
5689 | uint8_t style = highlightData->styleBuffer->BufGetCharacter(pos);
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/__string/char_traits.h:81:8: note: 'char_traits<unsigned char>' has been explicitly marked deprecated here
81 | struct _LIBCPP_DEPRECATED_(
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/__config:996:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
996 | # define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))
| ^
While I'm reporting, these warnings are emitted by the MacOS linker:
[ 39%] Linking CXX executable ../nc-ng
ld: warning: ignoring duplicate libraries: '../Regex/libRegex.a', '../Util/libUtil.a'
[ 41%] Linking CXX executable ../nedit-import
ld: warning: ignoring duplicate libraries: '../Regex/libRegex.a', '../Util/libUtil.a'
[ 55%] Linking CXX executable ../nedit-ng
ld: warning: ignoring duplicate libraries: '../Regex/libRegex.a', '../Util/libUtil.a'
Partial fix just merged in: https://github.com/eteran/nedit-ng/pull/370
The warning about std:char_traits<unsigned char> is interesting, because I didn't realize that it was an extension. I'll have to see about refactoring that out which is a slightly more complicated fix.
Hi @eteran, I just pulled the latest version from the master branch and built it on MacOS, seems to be working fine:
nedit-ng version 2025.2_rc1-15-g24274b0e-dirty
Built on: BSD4, x86_64, Clang 16.0 (Apple)
With Qt: 5.15.16
Running Qt: 5.15.16
Locale: en
Git branch: master
Git commit: 24274b0e4c6cb19ca8510dd786d0696417db2894
Apart from the char_traits<unsigned char> and linker warnings that I mentioned previously I'm seeing:
2 of these from the same file:
/Users/anj/Software/other/nedit-ng/src/SmartIndent.cpp:188:6: warning: no previous prototype for function 'LoadSmartIndentFromYaml' [-Wmissing-prototypes]
188 | void LoadSmartIndentFromYaml() {
| ^
/Users/anj/Software/other/nedit-ng/src/SmartIndent.cpp:188:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
188 | void LoadSmartIndentFromYaml() {
| ^
| static
this:
/Users/anj/Software/other/nedit-ng/Regex/RegexError.cpp:17:30: warning: format string is not a string literal [-Wformat-nonliteral]
17 | vsnprintf(buf, sizeof(buf), fmt, ap);
| ^~~
and these:
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:231:29: warning: format string is not a string literal [-Wformat-nonliteral]
231 | snprintf(msg, sizeof(msg), fmt, std::forward<T>(args)...);
| ^~~
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:246:10: note: in instantiation of function template specialization '(anonymous namespace)::ExecError<const char *&>' requested here
246 | return ExecError("%s argument out of domain", s);
| ^
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:231:29: warning: format string is not a string literal [-Wformat-nonliteral]
231 | snprintf(msg, sizeof(msg), fmt, std::forward<T>(args)...);
| ^~~
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:1121:11: note: in instantiation of function template specialization '(anonymous namespace)::ExecError<const char *>' requested here
1121 | return ExecError("referenced undefined argument: %s", s->name.c_str());
| ^
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:209:29: warning: format string is not a string literal [-Wformat-nonliteral]
209 | snprintf(msg, sizeof(msg), str.c_str(), std::forward<T>(args)...);
| ^~~~~~~~~~~
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:1131:11: note: in instantiation of function template specialization '(anonymous namespace)::ExecError<const char *>' requested here
1131 | return ExecError(ec, s->name.c_str());
| ^
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:231:29: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
231 | snprintf(msg, sizeof(msg), fmt, std::forward<T>(args)...);
| ^~~
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:1141:2: note: in instantiation of function template specialization '(anonymous namespace)::ExecError<>' requested here
1141 | PUSH(symVal);
| ^
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:1019:11: note: expanded from macro 'PUSH'
1019 | return ExecError(StackOverflowMsg); \
| ^
/Users/anj/Software/other/nedit-ng/Interpreter/interpret.cpp:231:29: note: treat the string as an argument to avoid this
231 | snprintf(msg, sizeof(msg), fmt, std::forward<T>(args)...);
| ^
| "%s",
You could just disable that warning for those last two files.
Ok awesome, I'll add fixing these to my queue.
I've already put a to-do in the code for the char traits stuff. I just got a get to it 😂
Good news, I have successfully got nedit-ng going on a macos CI/CD pipeline! So i'll be able to work in this more directly :-).
It'll even provide (ephemeral) pre-built binaries (x86-64 only for now). I'll update once it's merged!