> maybe it could be turned around a bit so that all the llvm/clang
> things are moved out of the gnuc block, but at the same time it fits
> the way mingw/rsx*/etc are handled now.
>
> i'd say leave it like this, and maybe do some shuffling several clang
> and/or llvm versions in the future, when things come to light. right
> now the question basiclaly is: can you get clang without llvm? can
> you get llvm without clang? i don't really know the answer to these,
> and that's what's needed to decide whether or not (and how) to move it
> out into it's own block.
actually, i've been thinking, and, embarrasingly enough, you are right
again.
the current way is very wrong. when compiled with clang1,
hb_compiler() will return "LLVM/Clang C 4.2.1".
this means that "this harbour was compiled with clang version 4.2.1",
whereas in reality this harbour was compiled with clang version 1.1,
which has no viable means of telling it's version information, but it
pretends to be gcc 4.2.1. if and when there will be a clang version
4.2.1, there will be no way of telling what's going on.
to that end, i propose the following:
- clang can be picked based on the presence of __clang__
- clang v2+ can be picked based on the presence of __clang_major__
- this is enough to pick out clang v1.x, which is about as precise as
we can get identifying clang 1.x (and this is rather enough).
the c++ fragment here is rather superfluous since there's no c++ in
clang1, trim as you see fit)
- with __llvm__ and __GNUC__ we are in llvm-gcc-land (for which we
have no support, trim as you see fit)
- you don't get __llvm__ only by itself (it'll have to be accompanied
by a frontend)
(and since everything in sunpro is hex, turn the bcd decoder to hex as
well)
Index: src/common/hbver.c
===================================================================
--- src/common/hbver.c (revision 14644)
+++ src/common/hbver.c (working copy)
@@ -700,7 +700,7 @@
iVerPatch = 0;
#endif
-#elif defined( __llvm__ ) && defined( __clang_major__ )
+#elif defined( __clang__ ) && defined( __clang_major__ )
pszName = "LLVM/Clang C";
@@ -712,6 +712,33 @@
hb_strncpy( szSub, "++", sizeof( szSub ) - 1 );
#endif
+#elif defined( __clang__ )
+
+ pszName = "LLVM/Clang C";
+ iVerMajor = iVerMinor = iVerPatch = 0;
+
+ #if defined( __cplusplus )
+ hb_strncpy( szSub, "++", sizeof( szSub ) - 1 );
+ #endif
+
+ hb_strncat( szSub, " 1.x", sizeof( szSub ) - 1 );
+
+#elif defined( __llvm__ ) && defined( __GNUC__ )
+
+ pszName = "LLVM/GNU C"
+
+ #if defined( __cplusplus )
+ hb_strncpy( szSub, "++", sizeof( szSub ) - 1 );
+ #endif
+
+ iVerMajor = __GNUC__;
+ iVerMinor = __GNUC_MINOR__;
+ #if defined( __GNUC_PATCHLEVEL__ )
+ iVerPatch = __GNUC_PATCHLEVEL__;
+ #else
+ iVerPatch = 0;
+ #endif
+
#elif defined( __GNUC__ )
#if defined( __DJGPP__ )
@@ -726,12 +753,6 @@
pszName = "EMX/RSXNT/Win32 GNU C";
#elif defined( __EMX__ )
pszName = "EMX GNU C";
- #elif defined( __clang__ ) && defined( __llvm__ )
- pszName = "LLVM/Clang C";
- #elif defined( __clang__ )
- pszName = "Clang/GNU C";
- #elif defined( __llvm__ )
- pszName = "LLVM/GNU C";
#else
pszName = "GNU C";
#endif
@@ -758,7 +779,7 @@
#else
iVerMajor = __SUNPRO_C / 0x1000;
iVerMinor = __SUNPRO_C / 0x10 & 0xff;
- iVerMinor = iVerMinor / 16 * 10 + iVerMinor % 16;
+ iVerMinor = iVerMinor / 0x10 * 0xa + iVerMinor % 0x10;
iVerPatch = __SUNPRO_C & 0xf;
#endif
@@ -772,7 +793,7 @@
#else
iVerMajor = __SUNPRO_CC / 0x1000;
iVerMinor = __SUNPRO_CC / 0x10 & 0xff;
- iVerMinor = iVerMinor / 16 * 10 + iVerMinor % 16;
+ iVerMinor = iVerMinor / 0x10 * 0xa + iVerMinor % 0x10;
iVerPatch = __SUNPRO_CC & 0xf;
#endif
--
[-]
mkdir /nonexistent
Index: src/common/hbver.c
===================================================================
--- src/common/hbver.c (revision 14644)
+++ src/common/hbver.c (working copy)
@@ -700,7 +700,7 @@
iVerPatch = 0;
#endif
-#elif defined( __llvm__ ) && defined( __clang_major__ )
+#elif defined( __clang__ ) && defined( __clang_major__ )
pszName = "LLVM/Clang C";
@@ -712,6 +712,33 @@
hb_strncpy( szSub, "++", sizeof( szSub ) - 1 );
#endif
+#elif defined( __clang__ )
+
+ pszName = "LLVM/Clang C";
+ iVerMajor = iVerMinor = iVerPatch = 0;
+
+ #if defined( __cplusplus )
+ hb_strncpy( szSub, "++", sizeof( szSub ) - 1 );
+ #endif
+
+ hb_strncat( szSub, " 1.x", sizeof( szSub ) - 1 );
+
+#elif defined( __llvm__ ) && defined( __GNUC__ )
+
+ pszName = "LLVM/GNU C"
+
+ #if defined( __cplusplus )
+ hb_strncpy( szSub, "++", sizeof( szSub ) - 1 );
+ #endif
+
+ iVerMajor = __GNUC__;
+ iVerMinor = __GNUC_MINOR__;
+ #if defined( __GNUC_PATCHLEVEL__ )
+ iVerPatch = __GNUC_PATCHLEVEL__;
+ #else
+ iVerPatch = 0;
+ #endif
+
#elif defined( __GNUC__ )
#if defined( __DJGPP__ )
@@ -726,12 +753,6 @@
pszName = "EMX/RSXNT/Win32 GNU C";
#elif defined( __EMX__ )
pszName = "EMX GNU C";
- #elif defined( __clang__ ) && defined( __llvm__ )
- pszName = "LLVM/Clang C";
- #elif defined( __clang__ )
- pszName = "Clang/GNU C";
- #elif defined( __llvm__ )
- pszName = "LLVM/GNU C";
#else
pszName = "GNU C";
#endif
@@ -758,7 +779,7 @@
#else
iVerMajor = __SUNPRO_C / 0x1000;
iVerMinor = __SUNPRO_C / 0x10 & 0xff;
- iVerMinor = iVerMinor / 16 * 10 + iVerMinor % 16;
+ iVerMinor = iVerMinor / 0x10 * 0xa + iVerMinor % 0x10;
iVerPatch = __SUNPRO_C & 0xf;
#endif
@@ -772,7 +793,7 @@
#else
iVerMajor = __SUNPRO_CC / 0x1000;
iVerMinor = __SUNPRO_CC / 0x10 & 0xff;
- iVerMinor = iVerMinor / 16 * 10 + iVerMinor % 16;
+ iVerMinor = iVerMinor / 0x10 * 0xa + iVerMinor % 0x10;
iVerPatch = __SUNPRO_CC & 0xf;
#endif
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour