Simplify clang vs clang++ selection process when compiling sources#20712
Merged
sbc100 merged 1 commit intoemscripten-core:mainfrom Nov 14, 2023
Merged
Simplify clang vs clang++ selection process when compiling sources#20712sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100 merged 1 commit intoemscripten-core:mainfrom
Conversation
Collaborator
Author
|
This helps with the next phase of #20577 which is to avoid running more than one clang subprocess when not needed. |
16d97f6 to
875e31c
Compare
Collaborator
Author
|
Split out from #20713 |
875e31c to
0439ebf
Compare
Base the choice solely on whether `emcc` or `em++` was used on the command line. This means that the handling C vs C++ input files will now simply match that of the underlying compiler. When running `clang` there is automatic language selection at the lower level such that that `clang -c file.cc` will run with `-x c++` internally and `clang -c file.c` will run with `-x c` internally. The situation with `clang++` (and now `em++`) is a bit different in that running `clang++` on `.c` input file not automatically use C mode and will generate a warning: ``` clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] ``` Previously we were hiding the warning but using `clang` internally even if the user ran with `emc++`.
0439ebf to
3b6f62a
Compare
RReverser
approved these changes
Nov 14, 2023
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.
Base the choice solely on whether
emccorem++was used on the command line. This means that the handling C vs C++ input files will now simply match that of the underlying compiler.When running
clangthere is automatic language selection at the lower level such that thatclang -c file.ccwill run with-x c++internally andclang -c file.cwill run with-x cinternally.The situation with
clang++(and nowem++) is a bit different in that runningclang++on.cinput file not automatically use C mode and will generate a warning:Previously we were hiding the warning but using
clanginternally even if the user ran withemc++.