Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emcc/em++ are detected as ToolFamily::Msvc #1185

Closed
meowtec opened this issue Aug 15, 2024 · 2 comments · Fixed by #1186 or #1187
Closed

emcc/em++ are detected as ToolFamily::Msvc #1185

meowtec opened this issue Aug 15, 2024 · 2 comments · Fixed by #1186 or #1187

Comments

@meowtec
Copy link
Contributor

meowtec commented Aug 15, 2024

introduced by: #1015
https://github.com/rust-lang/cc-rs/blob/main/src/tool.rs#L173-L174

For Msvc family, it will add -nologo as default flags., but emcc or em++ does not accept this.

@NobodyXu
Copy link
Collaborator

Thanks.

Does it define any macro that we could use to identify it?

We have a c source file for it, if there's a macro then we could use it.

https://github.com/rust-lang/cc-rs/blob/main/src/detect_compiler_family.c

@meowtec
Copy link
Contributor Author

meowtec commented Aug 16, 2024

Thanks.

Does it define any macro that we could use to identify it?

We have a c source file for it, if there's a macro then we could use it.

https://github.com/rust-lang/cc-rs/blob/main/src/detect_compiler_family.c

Yes, it is __EMSCRIPTEN__.

I modified detect_compiler_family.c to this:

#ifdef __clang__
#pragma message "clang"
#endif

#ifdef __GNUC__
#pragma message "gcc"
#endif

+ #ifdef __EMSCRIPTEN__
+ #pragma message "emscripten"
+ #endif

And the stdout is:

# 1 "/path/todetect_compiler_family.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 413 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "path/to/detect_compiler_family.c" 2

#pragma message("clang")



#pragma message("gcc")



#pragma message("emscripten")

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants