yi-wu-arm wrote: > This patch broke the Solaris build: > > ``` > FAILED: > tools/flang/runtime/CMakeFiles/obj.FortranRuntime.dir/extensions.cpp.o > [...] > /vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:60:24: error: > use of undeclared identifier 'LOGIN_NAME_MAX' > 60 | const int nameMaxLen{LOGIN_NAME_MAX + 1}; > | ^ > /vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:61:12: warning: > variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension] > 61 | char str[nameMaxLen]; > | ^~~~~~~~~~ > /vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:61:12: note: > initializer of 'nameMaxLen' is unknown > /vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:60:13: note: > declared here > 60 | const int nameMaxLen{LOGIN_NAME_MAX + 1}; > | ^ > 1 warning and 1 error generated. > ``` > > and > > ``` > FAILED: > tools/flang/unittests/Runtime/CMakeFiles/FlangRuntimeTests.dir/CommandTest.cpp.o > [...] > /vol/llvm/src/llvm-project/dist/flang/unittests/Runtime/CommandTest.cpp:530:21: > error: use of undeclared identifier 'LOGIN_NAME_MAX' > 530 | const int charLen{LOGIN_NAME_MAX + 2}; > | ^ > /vol/llvm/src/llvm-project/dist/flang/unittests/Runtime/CommandTest.cpp:531:14: > warning: variable length arrays in C++ are a Clang extension > [-Wvla-cxx-extension] > 531 | char input[charLen]; > | ^~~~~~~ > /vol/llvm/src/llvm-project/dist/flang/unittests/Runtime/CommandTest.cpp:531:14: > note: initializer of 'charLen' is unknown > /vol/llvm/src/llvm-project/dist/flang/unittests/Runtime/CommandTest.cpp:530:13: > note: declared here > 530 | const int charLen{LOGIN_NAME_MAX + 2}; > | ^ > ``` > > As documented in Solaris `limits.h(3HEAD)` (and exactly matching XPG7), > `LOGIN_NAME_MAX` not being defined is an allowed configuration: > > ``` > Runtime Invariant Values (Possibly Indeterminate) > A definition of one of the symbolic names in the following list is > omitted from <limits.h> on specific implementations where the corre- > sponding value is equal to or greater than the stated minimum, but is > unspecified. > > This indetermination might depend on the amount of available memory > space on a specific instance of a specific implementation. The actual > value supported by a specific instance will be provided by the > sysconf() function. > [...] > LOGIN_NAME_MAX > > Maximum length of a login name. > ``` > > So the code needs to fall back to `sysconf(_SC_LOGIN_NAME_MAX)` if > `LOGIN_NAME_MAX` is not defined. > > I've used the attached patch to implement this, which allowed the build and > `ninja check-all` to finish. I'm uncertain if support for `syscconf() == -1` > is really necessary, though. > [lnm.txt](https://github.com/llvm/llvm-project/files/13887475/lnm.txt)
Thanks for reporting and providing a fix for this. I do not have a Solaris instance on hand to test it, so if you don't mind, could you send this out as a pull request? https://github.com/llvm/llvm-project/pull/74628 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits