Skip to content

Commit f0bc13f

Browse files
yvals_core.h: Improve "error STL1003: Unexpected compiler, expected C++ compiler." like GH 4020.
Then we can move `_STL_STRINGIZE` down to its point of use, near our other macros. ``` D:\GitHub\STL\out\x64>type woof.c #include <vector> D:\GitHub\STL\out\x64>cl /EHsc /nologo /W4 /c woof.c woof.c D:\GitHub\STL\out\x64\out\inc\yvals_core.h(23): fatal error C1189: #error: error STL1003: Unexpected compiler, expected C++ compiler. ```
1 parent 67a471e commit f0bc13f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: stl/inc/yvals_core.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818

1919
#if _STL_COMPILER_PREPROCESSOR
2020

21-
// This does not use `_EMIT_STL_ERROR`, as it needs to be checked before we include anything else.
22-
#define _STL_STRINGIZE_(S) #S
23-
#define _STL_STRINGIZE(S) _STL_STRINGIZE_(S)
21+
// This does not use `_EMIT_STL_ERROR`, as it is checking the language itself.
2422
#ifndef __cplusplus
25-
#pragma message(__FILE__ "(" _STL_STRINGIZE(__LINE__) "): STL1003: Unexpected compiler, expected C++ compiler.")
26-
#error Error in C++ Standard Library usage
23+
#error error STL1003: Unexpected compiler, expected C++ compiler.
2724
#endif // !defined(__cplusplus)
2825

2926
// Implemented unconditionally:
@@ -504,6 +501,9 @@
504501
#include <vcruntime.h>
505502
#include <xkeycheck.h> // The _HAS_CXX tags must be defined before including this.
506503

504+
#define _STL_STRINGIZE_(S) #S
505+
#define _STL_STRINGIZE(S) _STL_STRINGIZE_(S)
506+
507507
// Note that _STL_PRAGMA is load-bearing;
508508
// it still needs to exist even once CUDA and ICC support _Pragma.
509509
#if defined(__CUDACC__) || defined(__INTEL_COMPILER)

0 commit comments

Comments
 (0)