[PATCH 02/59] fixup! libctf: restructure error handling to reduce relocations

Nick Alcock nick.alcock@oracle.com
Wed Jul 22 09:31:04 GMT 2020
We can't use _S as a macro name since it collides with a name in
Cygwin's <ctype.h>.

Use a less-collidy name instead.
---
 libctf/ctf-error.c  | 12 ++++++------
 libctf/mkerrors.sed |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libctf/ctf-error.c b/libctf/ctf-error.c
index ac42784df65..20971f4275b 100644
--- a/libctf/ctf-error.c
+++ b/libctf/ctf-error.c
@@ -37,17 +37,17 @@ static const union _ctf_errlist_t
 {
   __extension__ struct
   {
-#define _S(n, s) char ERRSTRFIELD (__LINE__) [sizeof (s)];
+#define _CTF_STR(n, s) char ERRSTRFIELD (__LINE__) [sizeof (s)];
 #include "ctf-error.h"
-#undef _S
+#undef _CTF_STR
   };
   char str[1];
 } _ctf_errlist =
   {
    {
-#define _S(n, s) s,
+#define _CTF_STR(n, s) s,
 #include "ctf-error.h"
-#undef _S
+#undef _CTF_STR
    }
   };
 
@@ -55,9 +55,9 @@ static const union _ctf_errlist_t
 
 static const unsigned int _ctf_erridx[] =
   {
-#define _S(n, s) [n - ECTF_BASE] = offsetof (union _ctf_errlist_t, ERRSTRFIELD (__LINE__)),
+#define _CTF_STR(n, s) [n - ECTF_BASE] = offsetof (union _ctf_errlist_t, ERRSTRFIELD (__LINE__)),
 #include "ctf-error.h"
-#undef _S
+#undef _CTF_STR
   };
 
 const char *
diff --git a/libctf/mkerrors.sed b/libctf/mkerrors.sed
index 146fd4abc1d..ddd4d2286e7 100644
--- a/libctf/mkerrors.sed
+++ b/libctf/mkerrors.sed
@@ -22,7 +22,7 @@
     /^ *ECTF_/!n;
     # Strip out the base initializer.
     s, = ECTF_BASE,,;
-    # Transform errors into _S(...).
-    s@^ *\(ECTF_[^[:blank:],]*\),\{0,1\}[[:blank:]]*/\* \(.*\).  \*/$@_S (\1, "\2")@;
+    # Transform errors into _STR(...).
+    s@^ *\(ECTF_[^[:blank:],]*\),\{0,1\}[[:blank:]]*/\* \(.*\).  \*/$@_CTF_STR (\1, "\2")@;
     p;
   }
-- 
2.27.0.247.g3dff7de930


More information about the Binutils mailing list