Hey hey,

I'm compiling gnupdf under llvm/clang; and found an issue with the
strerror-override module. In my setup, it defines strerror_override() to
NULL in the .h file, but then it implements the method anyway in the .c
file, and llvm/clang doesn't like that:

        strerror-override.c:35:1: error: expected identifier or '('
        strerror_override (int errnum)
        ^
        ./strerror-override.h:47:38: note: expanded from:
        #  define strerror_override(ignored) NULL

Attached a patch that fixes the issue.

Cheers,

-- 
Aleksander
From 069a96deff8ff021530e228a4a431fa091bce25a Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <[email protected]>
Date: Mon, 29 Aug 2011 13:52:21 +0200
Subject: [PATCH] strerror-override: avoid implementing the method if it won't be exported

Fixes the compilation under llvm/clang
---
 lib/strerror-override.c |    5 +++++
 lib/strerror-override.h |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/strerror-override.c b/lib/strerror-override.c
index d6ecf2e..34680e8 100644
--- a/lib/strerror-override.c
+++ b/lib/strerror-override.c
@@ -29,6 +29,8 @@
 # endif
 #endif
 
+#if GNULIB_implements_strerror_override
+
 /* If ERRNUM maps to an errno value defined by gnulib, return a string
    describing the error.  Otherwise return NULL.  */
 const char *
@@ -277,3 +279,6 @@ strerror_override (int errnum)
       return NULL;
     }
 }
+
+#endif
+
diff --git a/lib/strerror-override.h b/lib/strerror-override.h
index 81e4a50..f407b13 100644
--- a/lib/strerror-override.h
+++ b/lib/strerror-override.h
@@ -44,6 +44,7 @@
      || GNULIB_defined_ESTALE \
      || GNULIB_defined_EDQUOT \
      || GNULIB_defined_ECANCELED
+#  define GNULIB_implements_strerror_override 1
 extern const char *strerror_override (int errnum);
 # else
 #  define strerror_override(ignored) NULL
-- 
1.7.4.1

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to