bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 16/18] Makefile.am: Ensure indent builds with clang


From: Tim Hentenaar
Subject: [PATCH 16/18] Makefile.am: Ensure indent builds with clang
Date: Sat, 4 Jul 2015 13:43:30 +0200

Signed-off-by: Tim Hentenaar <address@hidden>
---
 src/Makefile.am | 18 ++++++++++++------
 src/gperf-cc.c  |  4 ++--
 src/gperf.c     |  4 ++--
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index f764662..ed60768 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,10 +18,12 @@ LIBS = @LIBINTL@ @LIBS@
 
 MAINTAINERCLEANFILES= Makefile.in libgettext.h
 
-AM_CFLAGS=-ansi -pedantic -Wall -Werror -Wredundant-decls -Wshadow
-AM_CFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-AM_CFLAGS+=-Wmissing-declarations -Wcomment -Wbad-function-cast
-AM_CFLAGS+=-Wcast-align -I.
+# Only pass -ansi and -pedantic via CC otherwise clang compains
+CCLD := $(CC)
+CC := $(CC) -ansi -pedantic
+AM_CFLAGS  = -Wall -Werror -Wredundant-decls -Wshadow -Wstrict-prototypes
+AM_CFLAGS += -Wmissing-prototypes -Wnested-externs -Wmissing-declarations
+AM_CFLAGS += -Wcomment -Wbad-function-cast -Wcast-align
 
 ## Use -g when in maintainer mode
 if MAINTAINER_MODE
@@ -31,13 +33,17 @@ endif
 gperf.c: indent.gperf
        @gperf -D -c -l -p -t -T -g -j1 -o -K rwd\
               -L ANSI-C -N is_reserved indent.gperf > gperf.c
-       @sed -ie 's/index/idx/g' gperf.c
+       @sed -i -e 's/index/idx/g'\
+               -e 's/ifdef __GNUC__/if defined(__GNUC__) \&\& 
\!defined(__clang__)/'\
+                gperf.c
 
 gperf-cc.c: indent-cc.gperf
        @gperf -D -c -l -p -t -T -g -j1 -o -K rwd\
               -L ANSI-C -N is_reserved_cc -H hash_cc\
               indent-cc.gperf > gperf-cc.c
-       @sed -ie 's/index/idx/g' gperf-cc.c
+       @sed -i -e 's/index/idx/g'\
+               -e 's/ifdef __GNUC__/if defined(__GNUC__) \&\& 
\!defined(__clang__)/'\
+                gperf-cc.c
 
 if MAINTAINER_MODE
 
diff --git a/src/gperf-cc.c b/src/gperf-cc.c
index 60a4d2b..61e2e76 100644
--- a/src/gperf-cc.c
+++ b/src/gperf-cc.c
@@ -37,7 +37,7 @@
 #define MAX_HASH_VALUE 57
 /* maximum key range = 55, duplicates = 0 */
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
 __inline
 #else
 #ifdef __cplusplus
@@ -91,7 +91,7 @@ hash_cc (register const char *str, register unsigned int len)
   return hval;
 }
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
 __inline
 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
diff --git a/src/gperf.c b/src/gperf.c
index 130b0e6..89a1a49 100644
--- a/src/gperf.c
+++ b/src/gperf.c
@@ -37,7 +37,7 @@
 #define MAX_HASH_VALUE 41
 /* maximum key range = 39, duplicates = 0 */
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
 __inline
 #else
 #ifdef __cplusplus
@@ -90,7 +90,7 @@ hash (register const char *str, register unsigned int len)
   return hval;
 }
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
 __inline
 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
-- 
2.3.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]