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

[clang++] unknown pragma inline_recursion #191

Closed UnixY2K closed 1 year ago

UnixY2K commented 1 year ago

Environment

TOML++ 3.3.0 (HEAD)

Compiler:
Clang++ 15.0.5

C++ standard mode:
C++ 20

Target arch:
x64

Library configuration overrides:

Relevant compilation flags:

Describe the bug

Found warnings related to unknown pragma inline_recursion while Using clang++/meson into header_start.h and header_end.h, this is caused since clang defines the _MSC_VER but does not have the inline_recursion pragma

Steps to reproduce (or a small repro code sample)

compile an example project that uses toml++ in meson using vainilla clang++ under windows

Additional information

managed to fix it by adding a check for __clang__ definition

header_start.h

//# {{
#ifdef __INTELLISENSE__
#include "preprocessor.h"
#endif
//# }}
TOML_PUSH_WARNINGS;
#ifdef _MSC_VER
#ifndef __clang__ 
#pragma inline_recursion(on)
#endif
#pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max
#endif

header_end.h

//# {{
#ifdef __INTELLISENSE__
#include "preprocessor.h"
#endif
//# }}
#ifdef _MSC_VER
#pragma pop_macro("min")
#pragma pop_macro("max")
#ifndef __clang__
#pragma inline_recursion(off)
#endif
#endif
TOML_POP_WARNINGS;