ENH: Make compiler id detection more robust
- Split INFO strings in source into multiple pieces to make sure assembly or other listings produced by the compiler are never matched by the regex - Store INFO strings via pointer instead of array to convince some compilers to store the string literally in the binary - This should help make it work for sdcc 2.8.0 RC1
This commit is contained in:
parent
d73d9eb0f0
commit
70c2dc8a64
|
@ -75,6 +75,10 @@ int main() { return 0; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
|
/* Construct the string literal in pieces to prevent the source from
|
||||||
|
getting matched. Store it in a pointer rather than an array
|
||||||
|
because some compilers will just produce instructions to fill the
|
||||||
|
array rather than assigning a pointer to a static array. */
|
||||||
|
char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||||
|
|
||||||
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
|
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
|
||||||
|
|
|
@ -63,6 +63,10 @@ int main() { return 0; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
|
/* Construct the string literal in pieces to prevent the source from
|
||||||
|
getting matched. Store it in a pointer rather than an array
|
||||||
|
because some compilers will just produce instructions to fill the
|
||||||
|
array rather than assigning a pointer to a static array. */
|
||||||
|
char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||||
|
|
||||||
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
|
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
|
||||||
|
|
|
@ -76,4 +76,8 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char info_platform[] = "INFO:platform[" PLATFORM_ID "]";
|
/* Construct the string literal in pieces to prevent the source from
|
||||||
|
getting matched. Store it in a pointer rather than an array
|
||||||
|
because some compilers will just produce instructions to fill the
|
||||||
|
array rather than assigning a pointer to a static array. */
|
||||||
|
char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||||
|
|
Loading…
Reference in New Issue