microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.46k stars 1.53k forks source link

clang option "-fms-extensions" is ignored for intellisense for clang-based compiler after Version 1.3.1 #7886

Closed Helmta closed 3 years ago

Helmta commented 3 years ago

Bug type: Language Service

VS-Code Version: 1.58.2 (system setup) OS: Windows_NT x64 10.0.18363

Hi, we are using Embarcadero C++ Builder 10.3 as our C++ compiler. It's a clang-based compiler. We are using cmake+ninja for compilation and it works but we can not use cmake as configuration-provider.

relevant setting:

"C_Cpp.default.intelliSenseMode": "windows-clang-x64", "C_Cpp.default.cppStandard": "c++17", "C_Cpp.default.cStandard": "c11", "C_Cpp.default.systemIncludePath": [ "C:/prg/Embarcadero/Studio/20.0/include/dinkumware64/", "C:/prg/Embarcadero/Studio/20.0/include/boost_1_68/", "C:/prg/Embarcadero/Studio/20.0/include/windows/" ], "C_Cpp.default.configurationProvider": "${default}", //suppress cmake asking for intellisense-provider on every startup "C_Cpp.default.compilerPath": "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe", "C_Cpp.default.compilerArgs": [ "-fms-extensions" ], "C_Cpp.intelliSenseEngine": "Default",

With C/C++ Version 1.3.1

C/C++ Logs in Debug-Mode: Attempting to get defaults from C compiler in "compilerPath" property: 'C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe' Querying compiler for default C++ language standard using command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -x c++ -E -dM nul Custom configuration provider 'CMake Tools' registered Detected language standard version: c++17 Querying compiler for default C language standard using command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -x c -E -dM nul Detected language standard version: c11 Querying compiler's default target using command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -dumpmachine Compiler returned default target value: Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. x86_64-pc-windows-elf

Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c11 -Wp,-v -E -dD -x c -m64 -fno-blocks nul Code browsing service initialized Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe' Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -m64 -fno-blocks nul ... other: --ms_extensions other: --clang other: --clang_version=50002 stdver: c++17 intelliSenseMode: windows-clang-x64 ...

Logs after trying to switch to "windows-gcc-x64": [28.7.2021, 09:39:01] For C source files, IntelliSenseMode was changed from "windows-gcc-x64" to "windows-clang-x64" based on compiler args and querying compilerPath: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" [28.7.2021, 09:39:03] For C++ source files, IntelliSenseMode was changed from "windows-gcc-x64" to "windows-clang-x64" based on compiler args and querying compilerPath: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe"

With C/C++ Version 1.5.1 (every Version after 1.3.1)

Attempting to get defaults from C compiler in "compilerPath" property: 'C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe' Querying compiler for default C++ language standard using command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -x c++ -E -dM nul Detected language standard version: c++17 Querying compiler for default C language standard using command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -x c -E -dM nul Detected language standard version: c11 Querying compiler's default target using command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -dumpmachine Compiler returned default target value: Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. x86_64-pc-windows-elf

Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c11 -Wp,-v -E -dD -x c -m64 -fno-blocks nul Code browsing service initialized Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe' Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -m64 -fno-blocks nul Custom configuration provider 'CMake Tools' registered ... --->at this point "other: --ms_extensions" is missing <--- other: --clang other: --clang_version=50002 stdver: c++17 intelliSenseMode: windows-clang-x64 ...

Colengms commented 3 years ago

Hi @Helmta. If the compiler is detected as clang, the C/C++ extension currently detects whether ms-extensions is enabled by detecting a define emitted by the compiler: _MSC_EXTENSIONS. This define is required to be set when ms-extensions is enabled. (Though, it's specifically associated with C compilation. Does your compiler not support C compilation?). We do this because it's not necessary to pass -fms-extensions to enable the feature. It can also become enabled by default (depending on current platform) or enabled based on a specified target. (i.e. --target arg). It sounds like you using a clang-derived compiler that has either removed the associated define, or is ignoring the -fms-extension passed to it (either by default, or based on other arguments).

If your compiler supports C compilation, this would seem to be a bug with the compiler not specifying a define associated with the feature.

Could you provide the output of the following 2 commands? (or a diff of the defines it outputs?)

"C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c11 -Wp,-v -E -dD -x c -fno-blocks nul "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fno-ms-extensions -std=c11 -Wp,-v -E -dD -x c -fno-blocks nul

I'm curious if that might provide some evidence of whether that compiler is recognizing the arg or ignoring it.

If the first one has _MSC_EXTENSIONS in the output, I'm curious if it get omitted by:

"C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul

Helmta commented 3 years ago

Hi, thanks for the hint with the _MSC_EXTENSIONS.

"C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c11 -Wp,-v -E -dD -x c -fno-blocks nul "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fno-ms-extensions -std=c11 -Wp,-v -E -dD -x c -fno-blocks nul "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul do not have _MSC_EXTENSIONS in theirs outputs.

Ouputs of C are the same

Output Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. nul: clang -cc1 version 5.0.2 based upon LLVM 5.0.2 default target i686-pc-windows-msvc ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\vcl" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\rtl" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\sdk" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\dinkumware64" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\crtl" #include "..." search starts here: #include <...> search starts here: c:\prg\embarcadero\studio\20.0\include c:\prg\embarcadero\studio\20.0\include\dinkumware64 C:\prg\Embarcadero\Studio\20.0\include\windows\crtl\de c:\prg\embarcadero\studio\20.0\include\windows\crtl C:\prg\Embarcadero\Studio\20.0\include\windows\rtl\de c:\prg\embarcadero\studio\20.0\include\windows\rtl c:\prg\embarcadero\studio\20.0\include\windows\vcl c:\prg\embarcadero\studio\20.0\include\windows\sdk c:\prg\embarcadero\studio\20.0\include\windows End of search list. \# 1 "nul" \# 1 "\" 1 \# 1 "\" 3 #define __llvm__ 1 #define __clang__ 1 #define __clang_major__ 5 #define __clang_minor__ 0 #define __clang_patchlevel__ 2 #define __clang_version__ "5.0.2 (36933.9854b07.fc1c373)" #define __ATOMIC_RELAXED 0 #define __ATOMIC_CONSUME 1 #define __ATOMIC_ACQUIRE 2 #define __ATOMIC_RELEASE 3 #define __ATOMIC_ACQ_REL 4 #define __ATOMIC_SEQ_CST 5 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __VERSION__ "4.2.1 Compatible Embarcadero Technologies Inc. bcc64 5.0.2 (36933.9854b07.fc1c373)" #define __STRICT_ANSI__ 1 #define __OBJC_BOOL_IS_BOOL 0 #define __CONSTANT_CFSTRINGS__ 1 #define __FUNC__ __FUNCTION__ #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_PDP_ENDIAN__ 3412 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #define __CHAR_BIT__ 8 #define __SCHAR_MAX__ 127 #define __SHRT_MAX__ 32767 #define __INT_MAX__ 2147483647 #define __LONG_MAX__ 2147483647L #define __LONG_LONG_MAX__ 9223372036854775807LL #define __WCHAR_MAX__ 65535 #define __INTMAX_MAX__ 9223372036854775807LL #define __SIZE_MAX__ 18446744073709551615ULL #define __UINTMAX_MAX__ 18446744073709551615ULL #define __PTRDIFF_MAX__ 9223372036854775807LL #define __INTPTR_MAX__ 9223372036854775807LL #define __UINTPTR_MAX__ 18446744073709551615ULL #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 4 #define __SIZEOF_LONG_DOUBLE__ 8 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_POINTER__ 8 #define __SIZEOF_SHORT__ 2 #define __SIZEOF_PTRDIFF_T__ 8 #define __SIZEOF_SIZE_T__ 8 #define __SIZEOF_WCHAR_T__ 2 #define __SIZEOF_WINT_T__ 4 #define __SIZEOF_INT128__ 16 #define __INTMAX_TYPE__ long long int #define __INTMAX_FMTd__ "lld" #define __INTMAX_FMTi__ "lli" #define __INTMAX_C_SUFFIX__ LL #define __UINTMAX_TYPE__ long long unsigned int #define __UINTMAX_FMTo__ "llo" #define __UINTMAX_FMTu__ "llu" #define __UINTMAX_FMTx__ "llx" #define __UINTMAX_FMTX__ "llX" #define __UINTMAX_C_SUFFIX__ ULL #define __INTMAX_WIDTH__ 64 #define __PTRDIFF_TYPE__ long long int #define __PTRDIFF_FMTd__ "lld" #define __PTRDIFF_FMTi__ "lli" #define __PTRDIFF_WIDTH__ 64 #define __INTPTR_TYPE__ long long int #define __INTPTR_FMTd__ "lld" #define __INTPTR_FMTi__ "lli" #define __INTPTR_WIDTH__ 64 #define __SIZE_TYPE__ long long unsigned int #define __SIZE_FMTo__ "llo" #define __SIZE_FMTu__ "llu" #define __SIZE_FMTx__ "llx" #define __SIZE_FMTX__ "llX" #define __SIZE_WIDTH__ 64 #define __WCHAR_TYPE__ unsigned short #define __WCHAR_WIDTH__ 16 #define __WINT_TYPE__ int #define __WINT_WIDTH__ 32 #define __SIG_ATOMIC_WIDTH__ 32 #define __SIG_ATOMIC_MAX__ 2147483647 #define __CHAR16_TYPE__ unsigned short #define __CHAR32_TYPE__ unsigned int #define __UINTMAX_WIDTH__ 64 #define __UINTPTR_TYPE__ long long unsigned int #define __UINTPTR_FMTo__ "llo" #define __UINTPTR_FMTu__ "llu" #define __UINTPTR_FMTx__ "llx" #define __UINTPTR_FMTX__ "llX" #define __UINTPTR_WIDTH__ 64 #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_HAS_DENORM__ 1 #define __FLT_DIG__ 6 #define __FLT_DECIMAL_DIG__ 9 #define __FLT_EPSILON__ 1.19209290e-7F #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MANT_DIG__ 24 #define __FLT_MAX_10_EXP__ 38 #define __FLT_MAX_EXP__ 128 #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __FLT_MIN_EXP__ (-125) #define __FLT_MIN__ 1.17549435e-38F #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __DBL_HAS_DENORM__ 1 #define __DBL_DIG__ 15 #define __DBL_DECIMAL_DIG__ 17 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __DBL_MANT_DIG__ 53 #define __DBL_MAX_10_EXP__ 308 #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN__ 2.2250738585072014e-308 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L #define __LDBL_HAS_DENORM__ 1 #define __LDBL_DIG__ 15 #define __LDBL_DECIMAL_DIG__ 17 #define __LDBL_EPSILON__ 2.2204460492503131e-16L #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_MANT_DIG__ 53 #define __LDBL_MAX_10_EXP__ 308 #define __LDBL_MAX_EXP__ 1024 #define __LDBL_MAX__ 1.7976931348623157e+308L #define __LDBL_MIN_10_EXP__ (-307) #define __LDBL_MIN_EXP__ (-1021) #define __LDBL_MIN__ 2.2250738585072014e-308L #define __POINTER_WIDTH__ 64 #define __BIGGEST_ALIGNMENT__ 16 #define __WCHAR_UNSIGNED__ 1 #define __INT8_TYPE__ signed char #define __INT8_FMTd__ "hhd" #define __INT8_FMTi__ "hhi" #define __INT8_C_SUFFIX__ #define __INT16_TYPE__ short #define __INT16_FMTd__ "hd" #define __INT16_FMTi__ "hi" #define __INT16_C_SUFFIX__ #define __INT32_TYPE__ int #define __INT32_FMTd__ "d" #define __INT32_FMTi__ "i" #define __INT32_C_SUFFIX__ #define __INT64_TYPE__ long long int #define __INT64_FMTd__ "lld" #define __INT64_FMTi__ "lli" #define __INT64_C_SUFFIX__ LL #define __UINT8_TYPE__ unsigned char #define __UINT8_FMTo__ "hho" #define __UINT8_FMTu__ "hhu" #define __UINT8_FMTx__ "hhx" #define __UINT8_FMTX__ "hhX" #define __UINT8_C_SUFFIX__ #define __UINT8_MAX__ 255 #define __INT8_MAX__ 127 #define __UINT16_TYPE__ unsigned short #define __UINT16_FMTo__ "ho" #define __UINT16_FMTu__ "hu" #define __UINT16_FMTx__ "hx" #define __UINT16_FMTX__ "hX" #define __UINT16_C_SUFFIX__ #define __UINT16_MAX__ 65535 #define __INT16_MAX__ 32767 #define __UINT32_TYPE__ unsigned int #define __UINT32_FMTo__ "o" #define __UINT32_FMTu__ "u" #define __UINT32_FMTx__ "x" #define __UINT32_FMTX__ "X" #define __UINT32_C_SUFFIX__ U #define __UINT32_MAX__ 4294967295U #define __INT32_MAX__ 2147483647 #define __UINT64_TYPE__ long long unsigned int #define __UINT64_FMTo__ "llo" #define __UINT64_FMTu__ "llu" #define __UINT64_FMTx__ "llx" #define __UINT64_FMTX__ "llX" #define __UINT64_C_SUFFIX__ ULL #define __UINT64_MAX__ 18446744073709551615ULL #define __INT64_MAX__ 9223372036854775807LL #define __INT_LEAST8_TYPE__ signed char #define __INT_LEAST8_MAX__ 127 #define __INT_LEAST8_FMTd__ "hhd" #define __INT_LEAST8_FMTi__ "hhi" #define __UINT_LEAST8_TYPE__ unsigned char #define __UINT_LEAST8_MAX__ 255 #define __UINT_LEAST8_FMTo__ "hho" #define __UINT_LEAST8_FMTu__ "hhu" #define __UINT_LEAST8_FMTx__ "hhx" #define __UINT_LEAST8_FMTX__ "hhX" #define __INT_LEAST16_TYPE__ short #define __INT_LEAST16_MAX__ 32767 #define __INT_LEAST16_FMTd__ "hd" #define __INT_LEAST16_FMTi__ "hi" #define __UINT_LEAST16_TYPE__ unsigned short #define __UINT_LEAST16_MAX__ 65535 #define __UINT_LEAST16_FMTo__ "ho" #define __UINT_LEAST16_FMTu__ "hu" #define __UINT_LEAST16_FMTx__ "hx" #define __UINT_LEAST16_FMTX__ "hX" #define __INT_LEAST32_TYPE__ int #define __INT_LEAST32_MAX__ 2147483647 #define __INT_LEAST32_FMTd__ "d" #define __INT_LEAST32_FMTi__ "i" #define __UINT_LEAST32_TYPE__ unsigned int #define __UINT_LEAST32_MAX__ 4294967295U #define __UINT_LEAST32_FMTo__ "o" #define __UINT_LEAST32_FMTu__ "u" #define __UINT_LEAST32_FMTx__ "x" #define __UINT_LEAST32_FMTX__ "X" #define __INT_LEAST64_TYPE__ long long int #define __INT_LEAST64_MAX__ 9223372036854775807LL #define __INT_LEAST64_FMTd__ "lld" #define __INT_LEAST64_FMTi__ "lli" #define __UINT_LEAST64_TYPE__ long long unsigned int #define __UINT_LEAST64_MAX__ 18446744073709551615ULL #define __UINT_LEAST64_FMTo__ "llo" #define __UINT_LEAST64_FMTu__ "llu" #define __UINT_LEAST64_FMTx__ "llx" #define __UINT_LEAST64_FMTX__ "llX" #define __INT_FAST8_TYPE__ signed char #define __INT_FAST8_MAX__ 127 #define __INT_FAST8_FMTd__ "hhd" #define __INT_FAST8_FMTi__ "hhi" #define __UINT_FAST8_TYPE__ unsigned char #define __UINT_FAST8_MAX__ 255 #define __UINT_FAST8_FMTo__ "hho" #define __UINT_FAST8_FMTu__ "hhu" #define __UINT_FAST8_FMTx__ "hhx" #define __UINT_FAST8_FMTX__ "hhX" #define __INT_FAST16_TYPE__ short #define __INT_FAST16_MAX__ 32767 #define __INT_FAST16_FMTd__ "hd" #define __INT_FAST16_FMTi__ "hi" #define __UINT_FAST16_TYPE__ unsigned short #define __UINT_FAST16_MAX__ 65535 #define __UINT_FAST16_FMTo__ "ho" #define __UINT_FAST16_FMTu__ "hu" #define __UINT_FAST16_FMTx__ "hx" #define __UINT_FAST16_FMTX__ "hX" #define __INT_FAST32_TYPE__ int #define __INT_FAST32_MAX__ 2147483647 #define __INT_FAST32_FMTd__ "d" #define __INT_FAST32_FMTi__ "i" #define __UINT_FAST32_TYPE__ unsigned int #define __UINT_FAST32_MAX__ 4294967295U #define __UINT_FAST32_FMTo__ "o" #define __UINT_FAST32_FMTu__ "u" #define __UINT_FAST32_FMTx__ "x" #define __UINT_FAST32_FMTX__ "X" #define __INT_FAST64_TYPE__ long long int #define __INT_FAST64_MAX__ 9223372036854775807LL #define __INT_FAST64_FMTd__ "lld" #define __INT_FAST64_FMTi__ "lli" #define __UINT_FAST64_TYPE__ long long unsigned int #define __UINT_FAST64_MAX__ 18446744073709551615ULL #define __UINT_FAST64_FMTo__ "llo" #define __UINT_FAST64_FMTu__ "llu" #define __UINT_FAST64_FMTx__ "llx" #define __UINT_FAST64_FMTX__ "llX" #define __USER_LABEL_PREFIX__ #define __FINITE_MATH_ONLY__ 0 #define __GNUC_STDC_INLINE__ 1 #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 #define __CLANG_ATOMIC_BOOL_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2 #define __CLANG_ATOMIC_INT_LOCK_FREE 2 #define __CLANG_ATOMIC_LONG_LOCK_FREE 2 #define __CLANG_ATOMIC_LLONG_LOCK_FREE 2 #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2 #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 #define __GCC_ATOMIC_INT_LOCK_FREE 2 #define __GCC_ATOMIC_LONG_LOCK_FREE 2 #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 #define __NO_INLINE__ 1 #define __PIC__ 1 #define __pic__ 1 #define __FLT_EVAL_METHOD__ 0 #define __FLT_RADIX__ 2 #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__ #define __amd64__ 1 #define __amd64 1 #define __x86_64 1 #define __x86_64__ 1 #define __k8 1 #define __k8__ 1 #define __tune_k8__ 1 #define __REGISTER_PREFIX__ #define __NO_MATH_INLINES 1 #define __FXSR__ 1 #define __SSE2__ 1 #define __SSE2_MATH__ 1 #define __SSE__ 1 #define __SSE_MATH__ 1 #define __MMX__ 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 #define _WIN32 1 #define _WIN64 1 #define _PUSHPOP_SUPPORTED 1 #define __FLAT__ 1 #define __CODEGEARC__ 0x0740 #define __BORLANDC__ 0x0740 #define __TURBOC__ 0x0740 #define __BCPLUSPLUS__ 0x0740 #define __TCPLUSPLUS__ 0x0740 #define __UUID_SUPPORT__ 1 #define __CODEGEARC_VERSION__ 0x07408ECC #define _Windows 1 #define _INTEGRAL_MAX_BITS 64 #define _M_X64 1 #define _M_AMD64 1 #define __STDC_HOSTED__ 1 #define __STDC_VERSION__ 201112L #define __STDC_UTF_16__ 1 #define __STDC_UTF_32__ 1 \# 1 "\" 1 \# 1 "\" 2 \# 1 "nul" 2

Output of C++ "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul

Output Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. nul: clang -cc1 version 5.0.2 based upon LLVM 5.0.2 default target i686-pc-windows-msvc ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\vcl" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\rtl" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\sdk" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\dinkumware64" ignoring duplicate directory "c:\prg\embarcadero\studio\20.0\include\windows\crtl" #include "..." search starts here: #include <...> search starts here: c:\prg\embarcadero\studio\20.0\include c:\prg\embarcadero\studio\20.0\include\dinkumware64 C:\prg\Embarcadero\Studio\20.0\include\windows\crtl\de c:\prg\embarcadero\studio\20.0\include\windows\crtl C:\prg\Embarcadero\Studio\20.0\include\windows\rtl\de c:\prg\embarcadero\studio\20.0\include\windows\rtl c:\prg\embarcadero\studio\20.0\include\windows\vcl c:\prg\embarcadero\studio\20.0\include\windows\sdk c:\prg\embarcadero\studio\20.0\include\windows End of search list. \# 1 "nul" \# 1 "\" 1 \# 1 "\" 3 #define __llvm__ 1 #define __clang__ 1 #define __clang_major__ 5 #define __clang_minor__ 0 #define __clang_patchlevel__ 2 #define __clang_version__ "5.0.2 (36933.9854b07.fc1c373)" #define __ATOMIC_RELAXED 0 #define __ATOMIC_CONSUME 1 #define __ATOMIC_ACQUIRE 2 #define __ATOMIC_RELEASE 3 #define __ATOMIC_ACQ_REL 4 #define __ATOMIC_SEQ_CST 5 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __VERSION__ "4.2.1 Compatible Embarcadero Technologies Inc. bcc64 5.0.2 (36933.9854b07.fc1c373)" #define __STRICT_ANSI__ 1 #define __GXX_EXPERIMENTAL_CXX0X__ 1 #define __OBJC_BOOL_IS_BOOL 0 #define __cpp_rtti 199711 #define __cpp_exceptions 199711 #define __cpp_unicode_characters 200704 #define __cpp_raw_strings 200710 #define __cpp_unicode_literals 200710 #define __cpp_user_defined_literals 200809 #define __cpp_lambdas 200907 #define __cpp_constexpr 201603 #define __cpp_range_based_for 201603 #define __cpp_static_assert 201411 #define __cpp_decltype 200707 #define __cpp_attributes 200809 #define __cpp_rvalue_references 200610 #define __cpp_variadic_templates 200704 #define __cpp_initializer_lists 200806 #define __cpp_delegating_constructors 200604 #define __cpp_nsdmi 200809 #define __cpp_inheriting_constructors 201511 #define __cpp_ref_qualifiers 200710 #define __cpp_alias_templates 200704 #define __cpp_binary_literals 201304 #define __cpp_digit_separators 201309 #define __cpp_init_captures 201304 #define __cpp_generic_lambdas 201304 #define __cpp_decltype_auto 201304 #define __cpp_return_type_deduction 201304 #define __cpp_aggregate_nsdmi 201304 #define __cpp_variable_templates 201304 #define __cpp_hex_float 201603 #define __cpp_inline_variables 201606 #define __cpp_noexcept_function_type 201510 #define __cpp_capture_star_this 201603 #define __cpp_if_constexpr 201606 #define __cpp_deduction_guides 201611 #define __cpp_template_auto 201606 #define __cpp_namespace_attributes 201411 #define __cpp_enumerator_attributes 201411 #define __cpp_nested_namespace_definitions 201411 #define __cpp_variadic_using 201611 #define __cpp_aggregate_bases 201603 #define __cpp_structured_bindings 201606 #define __cpp_nontype_template_args 201411 #define __cpp_fold_expressions 201603 #define __cpp_aligned_new 201606 #define __CONSTANT_CFSTRINGS__ 1 #define __EXCEPTIONS 1 #define __GXX_RTTI 1 #define __DEPRECATED 1 #define _WCHAR_T_DEFINED 1 #define _NATIVE_WCHAR_T_DEFINED 1 #define __FUNC__ __FUNCTION__ #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_PDP_ENDIAN__ 3412 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #define __CHAR_BIT__ 8 #define __SCHAR_MAX__ 127 #define __SHRT_MAX__ 32767 #define __INT_MAX__ 2147483647 #define __LONG_MAX__ 2147483647L #define __LONG_LONG_MAX__ 9223372036854775807LL #define __WCHAR_MAX__ 65535 #define __INTMAX_MAX__ 9223372036854775807LL #define __SIZE_MAX__ 18446744073709551615ULL #define __UINTMAX_MAX__ 18446744073709551615ULL #define __PTRDIFF_MAX__ 9223372036854775807LL #define __INTPTR_MAX__ 9223372036854775807LL #define __UINTPTR_MAX__ 18446744073709551615ULL #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 4 #define __SIZEOF_LONG_DOUBLE__ 8 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_POINTER__ 8 #define __SIZEOF_SHORT__ 2 #define __SIZEOF_PTRDIFF_T__ 8 #define __SIZEOF_SIZE_T__ 8 #define __SIZEOF_WCHAR_T__ 2 #define __SIZEOF_WINT_T__ 4 #define __SIZEOF_INT128__ 16 #define __INTMAX_TYPE__ long long int #define __INTMAX_FMTd__ "lld" #define __INTMAX_FMTi__ "lli" #define __INTMAX_C_SUFFIX__ LL #define __UINTMAX_TYPE__ long long unsigned int #define __UINTMAX_FMTo__ "llo" #define __UINTMAX_FMTu__ "llu" #define __UINTMAX_FMTx__ "llx" #define __UINTMAX_FMTX__ "llX" #define __UINTMAX_C_SUFFIX__ ULL #define __INTMAX_WIDTH__ 64 #define __PTRDIFF_TYPE__ long long int #define __PTRDIFF_FMTd__ "lld" #define __PTRDIFF_FMTi__ "lli" #define __PTRDIFF_WIDTH__ 64 #define __INTPTR_TYPE__ long long int #define __INTPTR_FMTd__ "lld" #define __INTPTR_FMTi__ "lli" #define __INTPTR_WIDTH__ 64 #define __SIZE_TYPE__ long long unsigned int #define __SIZE_FMTo__ "llo" #define __SIZE_FMTu__ "llu" #define __SIZE_FMTx__ "llx" #define __SIZE_FMTX__ "llX" #define __SIZE_WIDTH__ 64 #define __WCHAR_TYPE__ unsigned short #define __WCHAR_WIDTH__ 16 #define __WINT_TYPE__ int #define __WINT_WIDTH__ 32 #define __SIG_ATOMIC_WIDTH__ 32 #define __SIG_ATOMIC_MAX__ 2147483647 #define __CHAR16_TYPE__ unsigned short #define __CHAR32_TYPE__ unsigned int #define __UINTMAX_WIDTH__ 64 #define __UINTPTR_TYPE__ long long unsigned int #define __UINTPTR_FMTo__ "llo" #define __UINTPTR_FMTu__ "llu" #define __UINTPTR_FMTx__ "llx" #define __UINTPTR_FMTX__ "llX" #define __UINTPTR_WIDTH__ 64 #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_HAS_DENORM__ 1 #define __FLT_DIG__ 6 #define __FLT_DECIMAL_DIG__ 9 #define __FLT_EPSILON__ 1.19209290e-7F #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MANT_DIG__ 24 #define __FLT_MAX_10_EXP__ 38 #define __FLT_MAX_EXP__ 128 #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __FLT_MIN_EXP__ (-125) #define __FLT_MIN__ 1.17549435e-38F #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __DBL_HAS_DENORM__ 1 #define __DBL_DIG__ 15 #define __DBL_DECIMAL_DIG__ 17 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __DBL_MANT_DIG__ 53 #define __DBL_MAX_10_EXP__ 308 #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN__ 2.2250738585072014e-308 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L #define __LDBL_HAS_DENORM__ 1 #define __LDBL_DIG__ 15 #define __LDBL_DECIMAL_DIG__ 17 #define __LDBL_EPSILON__ 2.2204460492503131e-16L #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_MANT_DIG__ 53 #define __LDBL_MAX_10_EXP__ 308 #define __LDBL_MAX_EXP__ 1024 #define __LDBL_MAX__ 1.7976931348623157e+308L #define __LDBL_MIN_10_EXP__ (-307) #define __LDBL_MIN_EXP__ (-1021) #define __LDBL_MIN__ 2.2250738585072014e-308L #define __POINTER_WIDTH__ 64 #define __BIGGEST_ALIGNMENT__ 16 #define __WCHAR_UNSIGNED__ 1 #define __INT8_TYPE__ signed char #define __INT8_FMTd__ "hhd" #define __INT8_FMTi__ "hhi" #define __INT8_C_SUFFIX__ #define __INT16_TYPE__ short #define __INT16_FMTd__ "hd" #define __INT16_FMTi__ "hi" #define __INT16_C_SUFFIX__ #define __INT32_TYPE__ int #define __INT32_FMTd__ "d" #define __INT32_FMTi__ "i" #define __INT32_C_SUFFIX__ #define __INT64_TYPE__ long long int #define __INT64_FMTd__ "lld" #define __INT64_FMTi__ "lli" #define __INT64_C_SUFFIX__ LL #define __UINT8_TYPE__ unsigned char #define __UINT8_FMTo__ "hho" #define __UINT8_FMTu__ "hhu" #define __UINT8_FMTx__ "hhx" #define __UINT8_FMTX__ "hhX" #define __UINT8_C_SUFFIX__ #define __UINT8_MAX__ 255 #define __INT8_MAX__ 127 #define __UINT16_TYPE__ unsigned short #define __UINT16_FMTo__ "ho" #define __UINT16_FMTu__ "hu" #define __UINT16_FMTx__ "hx" #define __UINT16_FMTX__ "hX" #define __UINT16_C_SUFFIX__ #define __UINT16_MAX__ 65535 #define __INT16_MAX__ 32767 #define __UINT32_TYPE__ unsigned int #define __UINT32_FMTo__ "o" #define __UINT32_FMTu__ "u" #define __UINT32_FMTx__ "x" #define __UINT32_FMTX__ "X" #define __UINT32_C_SUFFIX__ U #define __UINT32_MAX__ 4294967295U #define __INT32_MAX__ 2147483647 #define __UINT64_TYPE__ long long unsigned int #define __UINT64_FMTo__ "llo" #define __UINT64_FMTu__ "llu" #define __UINT64_FMTx__ "llx" #define __UINT64_FMTX__ "llX" #define __UINT64_C_SUFFIX__ ULL #define __UINT64_MAX__ 18446744073709551615ULL #define __INT64_MAX__ 9223372036854775807LL #define __INT_LEAST8_TYPE__ signed char #define __INT_LEAST8_MAX__ 127 #define __INT_LEAST8_FMTd__ "hhd" #define __INT_LEAST8_FMTi__ "hhi" #define __UINT_LEAST8_TYPE__ unsigned char #define __UINT_LEAST8_MAX__ 255 #define __UINT_LEAST8_FMTo__ "hho" #define __UINT_LEAST8_FMTu__ "hhu" #define __UINT_LEAST8_FMTx__ "hhx" #define __UINT_LEAST8_FMTX__ "hhX" #define __INT_LEAST16_TYPE__ short #define __INT_LEAST16_MAX__ 32767 #define __INT_LEAST16_FMTd__ "hd" #define __INT_LEAST16_FMTi__ "hi" #define __UINT_LEAST16_TYPE__ unsigned short #define __UINT_LEAST16_MAX__ 65535 #define __UINT_LEAST16_FMTo__ "ho" #define __UINT_LEAST16_FMTu__ "hu" #define __UINT_LEAST16_FMTx__ "hx" #define __UINT_LEAST16_FMTX__ "hX" #define __INT_LEAST32_TYPE__ int #define __INT_LEAST32_MAX__ 2147483647 #define __INT_LEAST32_FMTd__ "d" #define __INT_LEAST32_FMTi__ "i" #define __UINT_LEAST32_TYPE__ unsigned int #define __UINT_LEAST32_MAX__ 4294967295U #define __UINT_LEAST32_FMTo__ "o" #define __UINT_LEAST32_FMTu__ "u" #define __UINT_LEAST32_FMTx__ "x" #define __UINT_LEAST32_FMTX__ "X" #define __INT_LEAST64_TYPE__ long long int #define __INT_LEAST64_MAX__ 9223372036854775807LL #define __INT_LEAST64_FMTd__ "lld" #define __INT_LEAST64_FMTi__ "lli" #define __UINT_LEAST64_TYPE__ long long unsigned int #define __UINT_LEAST64_MAX__ 18446744073709551615ULL #define __UINT_LEAST64_FMTo__ "llo" #define __UINT_LEAST64_FMTu__ "llu" #define __UINT_LEAST64_FMTx__ "llx" #define __UINT_LEAST64_FMTX__ "llX" #define __INT_FAST8_TYPE__ signed char #define __INT_FAST8_MAX__ 127 #define __INT_FAST8_FMTd__ "hhd" #define __INT_FAST8_FMTi__ "hhi" #define __UINT_FAST8_TYPE__ unsigned char #define __UINT_FAST8_MAX__ 255 #define __UINT_FAST8_FMTo__ "hho" #define __UINT_FAST8_FMTu__ "hhu" #define __UINT_FAST8_FMTx__ "hhx" #define __UINT_FAST8_FMTX__ "hhX" #define __INT_FAST16_TYPE__ short #define __INT_FAST16_MAX__ 32767 #define __INT_FAST16_FMTd__ "hd" #define __INT_FAST16_FMTi__ "hi" #define __UINT_FAST16_TYPE__ unsigned short #define __UINT_FAST16_MAX__ 65535 #define __UINT_FAST16_FMTo__ "ho" #define __UINT_FAST16_FMTu__ "hu" #define __UINT_FAST16_FMTx__ "hx" #define __UINT_FAST16_FMTX__ "hX" #define __INT_FAST32_TYPE__ int #define __INT_FAST32_MAX__ 2147483647 #define __INT_FAST32_FMTd__ "d" #define __INT_FAST32_FMTi__ "i" #define __UINT_FAST32_TYPE__ unsigned int #define __UINT_FAST32_MAX__ 4294967295U #define __UINT_FAST32_FMTo__ "o" #define __UINT_FAST32_FMTu__ "u" #define __UINT_FAST32_FMTx__ "x" #define __UINT_FAST32_FMTX__ "X" #define __INT_FAST64_TYPE__ long long int #define __INT_FAST64_MAX__ 9223372036854775807LL #define __INT_FAST64_FMTd__ "lld" #define __INT_FAST64_FMTi__ "lli" #define __UINT_FAST64_TYPE__ long long unsigned int #define __UINT_FAST64_MAX__ 18446744073709551615ULL #define __UINT_FAST64_FMTo__ "llo" #define __UINT_FAST64_FMTu__ "llu" #define __UINT_FAST64_FMTx__ "llx" #define __UINT_FAST64_FMTX__ "llX" #define __USER_LABEL_PREFIX__ #define __FINITE_MATH_ONLY__ 0 #define __GNUC_GNU_INLINE__ 1 #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 #define __CLANG_ATOMIC_BOOL_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2 #define __CLANG_ATOMIC_INT_LOCK_FREE 2 #define __CLANG_ATOMIC_LONG_LOCK_FREE 2 #define __CLANG_ATOMIC_LLONG_LOCK_FREE 2 #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2 #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 #define __GCC_ATOMIC_INT_LOCK_FREE 2 #define __GCC_ATOMIC_LONG_LOCK_FREE 2 #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 #define __NO_INLINE__ 1 #define __PIC__ 1 #define __pic__ 1 #define __FLT_EVAL_METHOD__ 0 #define __FLT_RADIX__ 2 #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__ #define __amd64__ 1 #define __amd64 1 #define __x86_64 1 #define __x86_64__ 1 #define __k8 1 #define __k8__ 1 #define __tune_k8__ 1 #define __REGISTER_PREFIX__ #define __NO_MATH_INLINES 1 #define __FXSR__ 1 #define __SSE2__ 1 #define __SSE2_MATH__ 1 #define __SSE__ 1 #define __SSE_MATH__ 1 #define __MMX__ 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 #define _WIN32 1 #define _WIN64 1 #define _CPPUNWIND 1 #define _PUSHPOP_SUPPORTED 1 #define __FLAT__ 1 #define __CODEGEARC__ 0x0740 #define __BORLANDC__ 0x0740 #define __TURBOC__ 0x0740 #define __BCPLUSPLUS__ 0x0740 #define __TCPLUSPLUS__ 0x0740 #define __UUID_SUPPORT__ 1 #define __CODEGEARC_VERSION__ 0x07408ECC #define _Windows 1 #define _INTEGRAL_MAX_BITS 64 #define _M_X64 1 #define _M_AMD64 1 #define __STDC_HOSTED__ 1 #define __cplusplus 201703L #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8ULL #define __STDC_UTF_16__ 1 #define __STDC_UTF_32__ 1 \# 1 "\" 1 \# 1 "\" 2 \# 1 "nul" 2

You can see the line clang -cc1 version 5.0.2 based upon LLVM 5.0.2 default target i686-pc-windows-msvc in the output.

So I played a bit with the commenadline args. Especially the -target option was interesting.

"C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -target=x86_64-pc-win32-elf -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" "-triple x86_64-pc-win32-elf" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -triple=x86_64-pc-win32-elf -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul has the same output as "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul

The only way i found to get the _MSC_EXTENSIONS defined is with -cc1 option and -fms-extensions "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -cc1 -fms-extensions -std=c++17 -E -dD -x c++ nul

Output \# 1 "nul" \# 1 "\" 1 \# 1 "\" 3 #define __llvm__ 1 #define __clang__ 1 #define __clang_major__ 5 #define __clang_minor__ 0 #define __clang_patchlevel__ 2 #define __clang_version__ "5.0.2 (36933.9854b07.fc1c373)" #define __GNUC_MINOR__ 2 #define __GNUC_PATCHLEVEL__ 1 #define __GNUC__ 4 #define __GXX_ABI_VERSION 1002 #define __ATOMIC_RELAXED 0 #define __ATOMIC_CONSUME 1 #define __ATOMIC_ACQUIRE 2 #define __ATOMIC_RELEASE 3 #define __ATOMIC_ACQ_REL 4 #define __ATOMIC_SEQ_CST 5 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __VERSION__ "4.2.1 Compatible Embarcadero Technologies Inc. bcc64 5.0.2 (36933.9854b07.fc1c373)" #define __STRICT_ANSI__ 1 #define __GXX_EXPERIMENTAL_CXX0X__ 1 #define __OBJC_BOOL_IS_BOOL 0 #define __cpp_rtti 199711 #define __cpp_unicode_characters 200704 #define __cpp_raw_strings 200710 #define __cpp_unicode_literals 200710 #define __cpp_user_defined_literals 200809 #define __cpp_lambdas 200907 #define __cpp_constexpr 201603 #define __cpp_range_based_for 201603 #define __cpp_static_assert 201411 #define __cpp_decltype 200707 #define __cpp_attributes 200809 #define __cpp_rvalue_references 200610 #define __cpp_variadic_templates 200704 #define __cpp_initializer_lists 200806 #define __cpp_delegating_constructors 200604 #define __cpp_nsdmi 200809 #define __cpp_inheriting_constructors 201511 #define __cpp_ref_qualifiers 200710 #define __cpp_alias_templates 200704 #define __cpp_threadsafe_static_init 200806 #define __cpp_binary_literals 201304 #define __cpp_digit_separators 201309 #define __cpp_init_captures 201304 #define __cpp_generic_lambdas 201304 #define __cpp_decltype_auto 201304 #define __cpp_return_type_deduction 201304 #define __cpp_aggregate_nsdmi 201304 #define __cpp_variable_templates 201304 #define __cpp_hex_float 201603 #define __cpp_inline_variables 201606 #define __cpp_noexcept_function_type 201510 #define __cpp_capture_star_this 201603 #define __cpp_if_constexpr 201606 #define __cpp_deduction_guides 201611 #define __cpp_template_auto 201606 #define __cpp_namespace_attributes 201411 #define __cpp_enumerator_attributes 201411 #define __cpp_nested_namespace_definitions 201411 #define __cpp_variadic_using 201611 #define __cpp_aggregate_bases 201603 #define __cpp_structured_bindings 201606 #define __cpp_nontype_template_args 201411 #define __cpp_fold_expressions 201603 #define __cpp_aligned_new 201606 #define __CONSTANT_CFSTRINGS__ 1 #define __GXX_RTTI 1 #define __GNUG__ 4 #define __GXX_WEAK__ 1 #define __private_extern__ extern #define _WCHAR_T_DEFINED 1 #define _NATIVE_WCHAR_T_DEFINED 1 #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_PDP_ENDIAN__ 3412 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #define _ILP32 1 #define __ILP32__ 1 #define __CHAR_BIT__ 8 #define __SCHAR_MAX__ 127 #define __SHRT_MAX__ 32767 #define __INT_MAX__ 2147483647 #define __LONG_MAX__ 2147483647L #define __LONG_LONG_MAX__ 9223372036854775807LL #define __WCHAR_MAX__ 65535 #define __INTMAX_MAX__ 9223372036854775807LL #define __SIZE_MAX__ 4294967295U #define __UINTMAX_MAX__ 18446744073709551615ULL #define __PTRDIFF_MAX__ 2147483647 #define __INTPTR_MAX__ 2147483647 #define __UINTPTR_MAX__ 4294967295U #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 4 #define __SIZEOF_LONG_DOUBLE__ 8 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_POINTER__ 4 #define __SIZEOF_SHORT__ 2 #define __SIZEOF_PTRDIFF_T__ 4 #define __SIZEOF_SIZE_T__ 4 #define __SIZEOF_WCHAR_T__ 2 #define __SIZEOF_WINT_T__ 4 #define __INTMAX_TYPE__ long long int #define __INTMAX_FMTd__ "lld" #define __INTMAX_FMTi__ "lli" #define __INTMAX_C_SUFFIX__ LL #define __UINTMAX_TYPE__ long long unsigned int #define __UINTMAX_FMTo__ "llo" #define __UINTMAX_FMTu__ "llu" #define __UINTMAX_FMTx__ "llx" #define __UINTMAX_FMTX__ "llX" #define __UINTMAX_C_SUFFIX__ ULL #define __INTMAX_WIDTH__ 64 #define __PTRDIFF_TYPE__ int #define __PTRDIFF_FMTd__ "d" #define __PTRDIFF_FMTi__ "i" #define __PTRDIFF_WIDTH__ 32 #define __INTPTR_TYPE__ int #define __INTPTR_FMTd__ "d" #define __INTPTR_FMTi__ "i" #define __INTPTR_WIDTH__ 32 #define __SIZE_TYPE__ unsigned int #define __SIZE_FMTo__ "o" #define __SIZE_FMTu__ "u" #define __SIZE_FMTx__ "x" #define __SIZE_FMTX__ "X" #define __SIZE_WIDTH__ 32 #define __WCHAR_TYPE__ unsigned short #define __WCHAR_WIDTH__ 16 #define __WINT_TYPE__ int #define __WINT_WIDTH__ 32 #define __SIG_ATOMIC_WIDTH__ 32 #define __SIG_ATOMIC_MAX__ 2147483647 #define __CHAR16_TYPE__ unsigned short #define __CHAR32_TYPE__ unsigned int #define __UINTMAX_WIDTH__ 64 #define __UINTPTR_TYPE__ unsigned int #define __UINTPTR_FMTo__ "o" #define __UINTPTR_FMTu__ "u" #define __UINTPTR_FMTx__ "x" #define __UINTPTR_FMTX__ "X" #define __UINTPTR_WIDTH__ 32 #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_HAS_DENORM__ 1 #define __FLT_DIG__ 6 #define __FLT_DECIMAL_DIG__ 9 #define __FLT_EPSILON__ 1.19209290e-7F #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MANT_DIG__ 24 #define __FLT_MAX_10_EXP__ 38 #define __FLT_MAX_EXP__ 128 #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __FLT_MIN_EXP__ (-125) #define __FLT_MIN__ 1.17549435e-38F #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __DBL_HAS_DENORM__ 1 #define __DBL_DIG__ 15 #define __DBL_DECIMAL_DIG__ 17 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __DBL_MANT_DIG__ 53 #define __DBL_MAX_10_EXP__ 308 #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN__ 2.2250738585072014e-308 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L #define __LDBL_HAS_DENORM__ 1 #define __LDBL_DIG__ 15 #define __LDBL_DECIMAL_DIG__ 17 #define __LDBL_EPSILON__ 2.2204460492503131e-16L #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_MANT_DIG__ 53 #define __LDBL_MAX_10_EXP__ 308 #define __LDBL_MAX_EXP__ 1024 #define __LDBL_MAX__ 1.7976931348623157e+308L #define __LDBL_MIN_10_EXP__ (-307) #define __LDBL_MIN_EXP__ (-1021) #define __LDBL_MIN__ 2.2250738585072014e-308L #define __POINTER_WIDTH__ 32 #define __BIGGEST_ALIGNMENT__ 16 #define __WCHAR_UNSIGNED__ 1 #define __INT8_TYPE__ signed char #define __INT8_FMTd__ "hhd" #define __INT8_FMTi__ "hhi" #define __INT8_C_SUFFIX__ #define __INT16_TYPE__ short #define __INT16_FMTd__ "hd" #define __INT16_FMTi__ "hi" #define __INT16_C_SUFFIX__ #define __INT32_TYPE__ int #define __INT32_FMTd__ "d" #define __INT32_FMTi__ "i" #define __INT32_C_SUFFIX__ #define __INT64_TYPE__ long long int #define __INT64_FMTd__ "lld" #define __INT64_FMTi__ "lli" #define __INT64_C_SUFFIX__ LL #define __UINT8_TYPE__ unsigned char #define __UINT8_FMTo__ "hho" #define __UINT8_FMTu__ "hhu" #define __UINT8_FMTx__ "hhx" #define __UINT8_FMTX__ "hhX" #define __UINT8_C_SUFFIX__ #define __UINT8_MAX__ 255 #define __INT8_MAX__ 127 #define __UINT16_TYPE__ unsigned short #define __UINT16_FMTo__ "ho" #define __UINT16_FMTu__ "hu" #define __UINT16_FMTx__ "hx" #define __UINT16_FMTX__ "hX" #define __UINT16_C_SUFFIX__ #define __UINT16_MAX__ 65535 #define __INT16_MAX__ 32767 #define __UINT32_TYPE__ unsigned int #define __UINT32_FMTo__ "o" #define __UINT32_FMTu__ "u" #define __UINT32_FMTx__ "x" #define __UINT32_FMTX__ "X" #define __UINT32_C_SUFFIX__ U #define __UINT32_MAX__ 4294967295U #define __INT32_MAX__ 2147483647 #define __UINT64_TYPE__ long long unsigned int #define __UINT64_FMTo__ "llo" #define __UINT64_FMTu__ "llu" #define __UINT64_FMTx__ "llx" #define __UINT64_FMTX__ "llX" #define __UINT64_C_SUFFIX__ ULL #define __UINT64_MAX__ 18446744073709551615ULL #define __INT64_MAX__ 9223372036854775807LL #define __INT_LEAST8_TYPE__ signed char #define __INT_LEAST8_MAX__ 127 #define __INT_LEAST8_FMTd__ "hhd" #define __INT_LEAST8_FMTi__ "hhi" #define __UINT_LEAST8_TYPE__ unsigned char #define __UINT_LEAST8_MAX__ 255 #define __UINT_LEAST8_FMTo__ "hho" #define __UINT_LEAST8_FMTu__ "hhu" #define __UINT_LEAST8_FMTx__ "hhx" #define __UINT_LEAST8_FMTX__ "hhX" #define __INT_LEAST16_TYPE__ short #define __INT_LEAST16_MAX__ 32767 #define __INT_LEAST16_FMTd__ "hd" #define __INT_LEAST16_FMTi__ "hi" #define __UINT_LEAST16_TYPE__ unsigned short #define __UINT_LEAST16_MAX__ 65535 #define __UINT_LEAST16_FMTo__ "ho" #define __UINT_LEAST16_FMTu__ "hu" #define __UINT_LEAST16_FMTx__ "hx" #define __UINT_LEAST16_FMTX__ "hX" #define __INT_LEAST32_TYPE__ int #define __INT_LEAST32_MAX__ 2147483647 #define __INT_LEAST32_FMTd__ "d" #define __INT_LEAST32_FMTi__ "i" #define __UINT_LEAST32_TYPE__ unsigned int #define __UINT_LEAST32_MAX__ 4294967295U #define __UINT_LEAST32_FMTo__ "o" #define __UINT_LEAST32_FMTu__ "u" #define __UINT_LEAST32_FMTx__ "x" #define __UINT_LEAST32_FMTX__ "X" #define __INT_LEAST64_TYPE__ long long int #define __INT_LEAST64_MAX__ 9223372036854775807LL #define __INT_LEAST64_FMTd__ "lld" #define __INT_LEAST64_FMTi__ "lli" #define __UINT_LEAST64_TYPE__ long long unsigned int #define __UINT_LEAST64_MAX__ 18446744073709551615ULL #define __UINT_LEAST64_FMTo__ "llo" #define __UINT_LEAST64_FMTu__ "llu" #define __UINT_LEAST64_FMTx__ "llx" #define __UINT_LEAST64_FMTX__ "llX" #define __INT_FAST8_TYPE__ signed char #define __INT_FAST8_MAX__ 127 #define __INT_FAST8_FMTd__ "hhd" #define __INT_FAST8_FMTi__ "hhi" #define __UINT_FAST8_TYPE__ unsigned char #define __UINT_FAST8_MAX__ 255 #define __UINT_FAST8_FMTo__ "hho" #define __UINT_FAST8_FMTu__ "hhu" #define __UINT_FAST8_FMTx__ "hhx" #define __UINT_FAST8_FMTX__ "hhX" #define __INT_FAST16_TYPE__ short #define __INT_FAST16_MAX__ 32767 #define __INT_FAST16_FMTd__ "hd" #define __INT_FAST16_FMTi__ "hi" #define __UINT_FAST16_TYPE__ unsigned short #define __UINT_FAST16_MAX__ 65535 #define __UINT_FAST16_FMTo__ "ho" #define __UINT_FAST16_FMTu__ "hu" #define __UINT_FAST16_FMTx__ "hx" #define __UINT_FAST16_FMTX__ "hX" #define __INT_FAST32_TYPE__ int #define __INT_FAST32_MAX__ 2147483647 #define __INT_FAST32_FMTd__ "d" #define __INT_FAST32_FMTi__ "i" #define __UINT_FAST32_TYPE__ unsigned int #define __UINT_FAST32_MAX__ 4294967295U #define __UINT_FAST32_FMTo__ "o" #define __UINT_FAST32_FMTu__ "u" #define __UINT_FAST32_FMTx__ "x" #define __UINT_FAST32_FMTX__ "X" #define __INT_FAST64_TYPE__ long long int #define __INT_FAST64_MAX__ 9223372036854775807LL #define __INT_FAST64_FMTd__ "lld" #define __INT_FAST64_FMTi__ "lli" #define __UINT_FAST64_TYPE__ long long unsigned int #define __UINT_FAST64_MAX__ 18446744073709551615ULL #define __UINT_FAST64_FMTo__ "llo" #define __UINT_FAST64_FMTu__ "llu" #define __UINT_FAST64_FMTx__ "llx" #define __UINT_FAST64_FMTX__ "llX" #define __USER_LABEL_PREFIX__ _ #define __FINITE_MATH_ONLY__ 0 #define __GNUC_GNU_INLINE__ 1 #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 #define __CLANG_ATOMIC_BOOL_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2 #define __CLANG_ATOMIC_INT_LOCK_FREE 2 #define __CLANG_ATOMIC_LONG_LOCK_FREE 2 #define __CLANG_ATOMIC_LLONG_LOCK_FREE 2 #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2 #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 #define __GCC_ATOMIC_INT_LOCK_FREE 2 #define __GCC_ATOMIC_LONG_LOCK_FREE 2 #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 #define __NO_INLINE__ 1 #define __FLT_EVAL_METHOD__ 2 #define __FLT_RADIX__ 2 #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__ #define __i386 1 #define __i386__ 1 #define __REGISTER_PREFIX__ #define __NO_MATH_INLINES 1 #define _M_IX86_FP 0 #define _WIN32 1 #define _CPPRTTI 1 #define __BOOL_DEFINED 1 #define _MSC_EXTENSIONS 1 #define _RVALUE_REFERENCES_V2_SUPPORTED 1 #define _RVALUE_REFERENCES_SUPPORTED 1 #define _NATIVE_NULLPTR_SUPPORTED 1 #define _INTEGRAL_MAX_BITS 64 #define _M_IX86 600 #define __STDC__ 1 #define __STDC_HOSTED__ 1 #define __cplusplus 201703L #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U #define __STDC_UTF_16__ 1 #define __STDC_UTF_32__ 1 \# 1 "\" 1 \# 1 "\" 2 \# 1 "nul" 2

Then i have to set the target with -triple <value> "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -cc1 -triple x86_64-pc-win32-elf -fms-extensions -std=c++17 -E -dD -x c++ nul

So I tried to set -cc1 in the settings but it is ignored.

Settings "C_Cpp.default.compilerPath": "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe", "C_Cpp.default.compilerArgs": [ "-cc1", "-triple x86_64-pc-win32-elf", "-fborland-extensions", "-fexceptions", "-fms-extensions" ],
Error Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe' Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -triple x86_64-pc-win32-elf -fborland-extensions -fexceptions -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -m64 -fno-blocks nul Failed to query compiler. Falling back to 32-bit intelliSenseMode. Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -triple x86_64-pc-win32-elf -fborland-extensions -fexceptions -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -m32 -fno-blocks nul Failed to query compiler. Falling back to no bitness. Compiler query command line: "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -triple x86_64-pc-win32-elf -fborland-extensions -fexceptions -fms-extensions -std=c++17 -Wp,-v -E -dD -x c++ -fno-blocks nul bcc64.exe: error: no such file or directory: 'x86_64-pc-win32-elf'

or

Settings "C_Cpp.default.compilerPath": "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe -cc1 -triple x86_64-pc-win32-elf -fms-extensions",
Error Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe' No suitable compiler found.

With "C_Cpp.default.compilerPath": "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe -cc1 -fms-extensions", -cc1 and -fms-extensions are just ignored.

Extra Information

C:\WINDOWS\system32>bcc64 -cc1 -version LLVM (http://llvm.org/): LLVM version 5.0.2 DEBUG build. Default target: i686-pc-windows-msvc Host CPU: skylake

C:\WINDOWS\system32>bcc64 --version Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. Embarcadero Technologies Inc. bcc64 version 5.0.2 (36933.9854b07.fc1c373) (based on LLVM 5.0.2) Target: x86_64-pc-windows-elf Thread model: posix InstalledDir: C:\prg\Embarcadero\Studio\20.0\bin

stripped commandline with all args the original GUI is invoking "C:/prg/Embarcadero/Studio/20.0/bin/bcc64.exe" -cc1 -dwarf-version=2 -fborland-extensions -fdiagnostics-format borland -nobuiltininc -nostdsysteminc -triple x86_64-pc-win32-elf -emit-obj -fexceptions -fcxx-exceptions -fseh -munwind-tables -fno-common -fno-spell-checking -fno-use-cxa-atexit -x c++ -std=c++17 -O2 -fmath-errno -tR -tD -tM -tU -PD -sys-header-deps -E -dD -x c++ nul This does not define _MSC_EXTENSIONS either. But it works and cmake does the job too even without the -cc1 option.

Colengms commented 3 years ago

Hi @Helmta . Does your code include uses of MS extensions that fail to compile when -fms-extensions is not specified? If so, I believe we can fix this by falling back to checking the compiler argument if the define is not found.

I'm not familiar with either the -cc1 or triple arguments. I don't see them specified on either:

That would explain why we are not processing them. Can you refer me to documentation that describes them? We should be able to fix the issue with -cc1 not being passed through, but I could use more info on the format of the value passed to -triple. Is it the same as --target?

Colengms commented 3 years ago

Using clang (9, 10, 11, 12), I haven't been able to get it to accept a -triple arg. I get:

clang: error: unknown argument: '-triple'

Is that something unique to Embarcadero C++ ? The form appears to be the same as --target.

Helmta commented 3 years ago

Hi @Colengms .

Does your code include uses of MS extensions that fail to compile when -fms-extensions is not specified? If so, I believe we can fix this by falling back to checking the compiler argument if the define is not found.

The code compiles without problems. I think that -fms-extensions is set somewhere implicitly. The fallback would be great.

I'm not familiar with either the -cc1 or triple arguments. I don't see them specified on either:

I have not found any documentation either. The only way is throuh clang -help and compare the output to clang -cc1 -help. -cc1 has to be the very first argument. So -triple works only with -cc1: clang -cc1 -triple <value> and i think it is the same as --target

https://stackoverflow.com/questions/8991662/what-does-the-clang-cc1-option-do This explains what -cc1 does.

Thanks for ur great help. I will be on vacation for 10 days, so i can not answer.

Colengms commented 3 years ago

The code compiles without problems. I think that -fms-extensions is set somewhere implicitly. The fallback would be great.

Hi @Helmta . I'd like to confirm that the compiler is actually supporting -fms-extensions and not ignoring the arg, before I add support for this scenario. Does your code compile if -fno-ms-extensions is passed instead? If so, it's possible the lack of expected define is due to the feature not actually being enabled.

-cc1 provides access to clang's internal, undocumented args that are passed directly to its compiler layer instead of being processed by the GCC compatibility layer. The C/C++ extension currently supports only the args for the GCC compatibility layer. I've opened the following feature request to add support for internal clang args: https://github.com/microsoft/vscode-cpptools/issues/7900

Helmta commented 3 years ago

Hi @Colengms . I tested both clang and bcc64 compiler with testcode. I can confirm that clang is working as expected and bcc64 is ignoring the options -fms-extensions and -fno-ms-extensions. It compiles successfully, so I think the ms-extensions are enabled by default without setting the define.

Test.cpp: __declspec(dllexport) void TestFunction(int const test) { auto newTest = test; }

D:\PGA>clang -fno-ms-extensions -c test.cpp test.cpp:1:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes __declspec(dllexport) void TestFunction(int const test) ^ 1 error generated.

D:\PGA>bcc64 -fno-ms-extensions -c test.cpp Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. bcc64.exe: warning: argument unused during compilation: '-fno-ms-extensions' [-Wunused-command-line-argument] test.cpp:

D:\PGA>bcc64 -fms-extensions -c test.cpp Embarcadero C++ 7.40 for Win64 Copyright (c) 2012-2018 Embarcadero Technologies, Inc. bcc64.exe: warning: argument unused during compilation: '-fms-extensions' [-Wunused-command-line-argument] test.cpp:

If I use the -cc1 option, I need to activate the ms-extensions.

D:\PGA>bcc64 -cc1 test.cpp test.cpp:3:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes __declspec(dllexport) void TestFunction(int const test) ^ test.cpp:5:3: warning: 'auto' type specifier is a C++11 extension auto newTest = test; ^ 1 warning and 1 error generated.

D:\PGA>bcc64 -cc1 -fms-extensions test.cpp test.cpp:5:3: warning: 'auto' type specifier is a C++11 extension auto newTest = test; ^ 1 warning generated.

D:\PGA>bcc64 -cc1 -fno-ms-extensions test.cpp error: unknown argument: '-fno-ms-extensions'

I tested more code with the original GUI and it is allways invoking the compiler with the -cc1 option.

Colengms commented 3 years ago

This should be addressed in 1.6.0-insiders.

Note that was addressed by honoring the arg if present on the command line, not by hard-coding awareness of bcc64 (which may be a better solution). Also, because -cc1 is not yet supported (https://github.com/microsoft/vscode-cpptools/issues/7900), I'd suggesting passing it without -cc1 (as it should be ignored by the compiler when queried).