nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
42.01k stars 6.63k forks source link

Do not use `#pragma once` #3975

Closed davidstone closed 11 months ago

davidstone commented 1 year ago

Fixes https://github.com/nlohmann/json/issues/3974 by using the standard-compliant #ifndef #define #endif pattern instead of #pragma once.

nlohmann commented 1 year ago

(Ignore my comment before. Thanks for looking into the issue!)

davidstone commented 1 year ago

(Ignore my comment before. Thanks for looking into the issue!)

Yeah, it's an unfortunate change. #pragma once is definitely cleaner and less bug-prone. :(

github-actions[bot] commented 1 year ago

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @davidstone Please read and follow the Contribution Guidelines.

coveralls commented 1 year ago

Coverage Status

Coverage: 100.0%. Remained the same when pulling e1fca0b1ae4d95f0a6c482aa0667895b63132d8f on davidstone:develop into 6af826d0bdb55e4b69e3ad817576745335f243ca on nlohmann:develop.

davidstone commented 1 year ago

The remaining failures are unrelated to my changes. clang 16.0 was just released and it adds a new warning, Wunsafe-buffer-usage, and that warning is being triggered by existing code.

nlohmann commented 1 year ago

The ci_cpplint step is still failing.

gregmarr commented 1 year ago

@davidstone You probably need to merge in the latest changes to fix the CI.

davidstone commented 11 months ago

Newer versions of clang have fixed this bug. If someone else wants to take over this to get the PR working for versions of clang without the fix (I don't know which numbered versions are broken vs. working) feel free, but given that I prefer the way the code is with #pragma once and there are plenty of other modules bugs fixed in newer versions of clang, I'm happy to just abandon this.