microsoft / GSL

Guidelines Support Library
Other
6.19k stars 740 forks source link

can't compile gsl_tests with VS2022: warning C4067: unexpected tokens following preprocessor directive #1155

Closed juandent closed 3 weeks ago

juandent commented 3 months ago

Just cloned gsl and tried compiling project gsl_tests which has /WX option and the error occurs at:

#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")

As far as I know, Visual Studio does not define clang so it should short circuit before testing __has_warning! I understand VS does not define __has_warning correct?

I compiled using /std:c++20 but I think this does not matter

zygfrydw commented 1 month ago

I have fixed this issue in PR1157

beinhaerter commented 1 month ago

I fixed that already in #1149 in March - only waiting for it to be merged. I don't know if two PRs with the same fix help.

zygfrydw commented 1 month ago

Ohh, I have not noticed your fix, it just has bitten me recently so I fixed it. Seeing that your PR is not merged either I am afraid that it does not matter as there is not much maintenance going on.

carsonRadtke commented 3 weeks ago

Thank you for the report; this was recently fixed. Closing as "completed". https://github.com/microsoft/GSL/pull/1149