Solaris: only pass SunPro -erroff to SunPro compilers#6570
Open
hyoklee wants to merge 1 commit into
Open
Conversation
On SunOS the C and C++ flag files appended the single string "-erroff=%none -DBSD_COMP" to HDF5_CMAKE_C/CXX_FLAGS. Because that is one list element, target_compile_options() hands it to the compiler as one argument, and -erroff is an Oracle Developer Studio option to begin with. gcc silently ignores the result (it parses the leading -e as the linker entry-symbol option), but clang errors out: clang: error: unknown argument: '-erroff=%none -DBSD_COMP' which breaks the build on the first object file. As a side effect, -DBSD_COMP was never actually reaching the compiler as a define. Emit -erroff=%none only for SunPro, and append -DBSD_COMP as its own list element so it is passed as a separate argument on all Solaris compilers. Fixes HDFGroup#6569 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
Review ChecklistThis PR touches the following areas. Each needs a sign-off
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6569
Problem
On Solaris, both flag files append the SunPro-only
-erroffoption for every compiler, bundled with-DBSD_COMPin a single list element:Since that is one list element,
target_compile_options()passes it to the compiler as one argument. Clang rejects it and the build fails on the very first object file:GCC masks the bug rather than hitting it: it parses the leading
-eof-erroff=...as the linker entry-symbol option and consumes the rest as that option's argument, so at compile time the whole string is simply discarded. Reproducible anywhere:A side effect worth noting:
-DBSD_COMPwas not actually reaching any Solaris compiler as a define, under GCC or SunPro.Fix
Pass
-erroff=%noneonly when the compiler is Oracle Developer Studio (SunPro), and append-DBSD_COMPas its own list element so it is a separate argument for all Solaris compilers. Same change in the C and C++ flag files; nothing else is touched.Testing
Built and tested on Solaris 11.4 in CI:
H5.c.o; now 0 compiler errors, 0 compiler warnings, 2847/2847 tests passed.No behavior change on any non-SunOS platform: the modified branch is inside
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS").