Re: [PATCH 2/2] Improve portability: Avoid SS constant as it is already defined

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/2] Improve portability: Avoid SS constant as it is already defined

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:14

Junio C Hamano [off-list ref] writes:
David Soria Parra [off-list ref] writes:
quoted
From: David Soria Parra <redacted>

Constants that have the names of CPU registers are already defined
in OpenSolaris's sys/regset.h. This causes a warning as we try to
(re)define SS in ctype.c. So we just use another name.
I do not mind this _particular_ workaround per-se, but I have to wonder
what happens the next time some random other platform has "SP" defined in
a random header file.
If we are doing an workaround, how about doing it this way instead?

 ctype.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git i/ctype.c w/ctype.c
index ee06eb7..d2bd38e 100644
--- i/ctype.c
+++ w/ctype.c
@@ -5,6 +5,11 @@
  */
 #include "cache.h"
 
+/* Just so that no insane platform contaminates the namespace with these symbols */
+#undef SS
+#undef AA
+#undef DD
+
 #define SS GIT_SPACE
 #define AA GIT_ALPHA
 #define DD GIT_DIGIT

Re: [PATCH 2/2] Improve portability: Avoid SS constant as it is already defined

From: David Soria Parra <hidden>
Date: 2016-06-15 22:45:14

Should be fine as well.

Junio C Hamano wrote:
quoted hunk
Junio C Hamano [off-list ref] writes:
quoted
David Soria Parra [off-list ref] writes:
quoted
From: David Soria Parra <redacted>

Constants that have the names of CPU registers are already defined
in OpenSolaris's sys/regset.h. This causes a warning as we try to
(re)define SS in ctype.c. So we just use another name.
I do not mind this _particular_ workaround per-se, but I have to wonder
what happens the next time some random other platform has "SP" defined in
a random header file.
If we are doing an workaround, how about doing it this way instead?

 ctype.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git i/ctype.c w/ctype.c
index ee06eb7..d2bd38e 100644
--- i/ctype.c
+++ w/ctype.c
@@ -5,6 +5,11 @@
  */
 #include "cache.h"
 
+/* Just so that no insane platform contaminates the namespace with these symbols */
+#undef SS
+#undef AA
+#undef DD
+
 #define SS GIT_SPACE
 #define AA GIT_ALPHA
 #define DD GIT_DIGIT
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help