marzer / tomlplusplus

Header-only TOML config file parser and serializer for C++17.
https://marzer.github.io/tomlplusplus/
MIT License
1.53k stars 146 forks source link

Error during compilation with NVCC #198

Closed thompsonnoahe closed 1 year ago

thompsonnoahe commented 1 year ago

Environment

toml++ version and/or commit hash: v3.3.0

Compiler: nvcc V10.2.300

C++ standard mode: 17

Target arch: aarch64

Library configuration overrides: None

Relevant compilation flags: --compiler-options -std=c++17

Describe the bug

During compilation of toml++ with nvcc, NVIDIA's CUDA Compiler, the compiler errors out with the following status:

/usr/local/include/toml++/impl/preprocessor.h:275:59: error: missing ')' after "__has_attribute"
 #elif TOML_GCC || TOML_CLANG || TOML_HAS_ATTR(__noinline__)

/usr/local/include/toml++/impl/preprocessor.h:275:47: error: missing binary operator before token "("
 #elif TOML_GCC || TOML_CLANG || TOML_HAS_ATTR(__noinline__)

Additional information

NVIDIA CUDA Runtime v10.2.

marzer commented 1 year ago

@thompsonnoahe I'm looking into this now. Looks like CUDA reserves __noinline__ for it's own purposes, causing this issue: https://stackoverflow.com/questions/70301375/noinline-macro-conflict-between-glib-and-cuda/

marzer commented 1 year ago

Alright I've pushed a fix for this. I'm not easily able to test this myself currently so if you still have further issues feel free to re-open it and I'll have a deeper look into it. Thanks for the report!