[clang] 6c3a290 - Headers: further refine the `stdatomic.h` MSVC inclusion

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 11:09:27 PST 2022


Author: Saleem Abdulrasool
Date: 2022-12-21T19:09:10Z
New Revision: 6c3a2902f1f8d102aa5b3cd37def4f1420ac0c80

URL: https://github.com/llvm/llvm-project/commit/6c3a2902f1f8d102aa5b3cd37def4f1420ac0c80
DIFF: https://github.com/llvm/llvm-project/commit/6c3a2902f1f8d102aa5b3cd37def4f1420ac0c80.diff

LOG: Headers: further refine the `stdatomic.h` MSVC inclusion

The `stdatomic.h` header cannot be included under MSVC when in C++ mode
as the toolsets prior to 17.5.0 Preview 2 do not support the C11
atomics.  However, some toolsets prior to the aforementioned version
support the atomics under the C++ mode.  In these versions the MSVC
toolset protects against the contamination by entirely eliding the
declarations, resulting in build failures in some cases.  Unfortunately,
e0c3142af075e2ef89395dbed5939071345eb622 accidentally regressed the C
case when fixing the C++ support.

Unfortunately, we cannot test this reliably as we need to inject a
header after the resource path as a system header path, which we do not
have a reliable means of doing.

Fixes: #59640

Added: 
    

Modified: 
    clang/lib/Headers/stdatomic.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/stdatomic.h b/clang/lib/Headers/stdatomic.h
index 9093851b76cfc..0f893beea6ca2 100644
--- a/clang/lib/Headers/stdatomic.h
+++ b/clang/lib/Headers/stdatomic.h
@@ -20,7 +20,7 @@
  */
 #if __STDC_HOSTED__ &&                                                         \
     __has_include_next(<stdatomic.h>) &&                                       \
-    !(defined(_MSC_VER) && defined(__cplusplus) && __cplusplus < 202002L)
+    (!defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 202002L))
 # include_next <stdatomic.h>
 #else
 


        


More information about the cfe-commits mailing list