]> granicus.if.org Git - file/commitdiff
deal with gcc'isms FILE4_25
authorChristos Zoulas <christos@zoulas.com>
Tue, 15 Jul 2008 17:45:13 +0000 (17:45 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 15 Jul 2008 17:45:13 +0000 (17:45 +0000)
configure.ac
src/Makefile.am
src/file.h

index 9fd15bdefcabadacddf8ef8cb3eebef005ad06df..bcea5c7b0138501a70c4562f6ef81c6f4e3f2a3d 100644 (file)
@@ -45,8 +45,11 @@ fi], [
   AC_MSG_RESULT(no)
   fsect=4
 ])
+
 AC_SUBST(fsect)
 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
+
+AC_SUBST(WARNINGS)
 AC_GNU_SOURCE
 
 dnl Checks for programs.
@@ -108,6 +111,30 @@ typedef long int64_t;
 #endif
 ])
 
+AC_MSG_CHECKING(for gcc compiler warnings)
+AC_ARG_ENABLE(warnings,
+[  --disable-warnings  disable compiler warnings],
+[if test "${enableval}" = no -o $GCC = no; then
+   AC_MSG_RESULT(no)
+   WARNINGS=
+else
+   AC_MSG_RESULT(yes)
+   WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
+       -Wmissing-declarations -Wredundant-decls -Wnested-externs \
+       -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
+       -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
+fi], [
+if test $GCC = no; then
+   WARNINGS=
+   AC_MSG_RESULT(no)
+else
+   AC_MSG_RESULT(yes)
+   WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
+       -Wmissing-declarations -Wredundant-decls -Wnested-externs \
+       -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
+       -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
+fi])
+
 dnl Checks for functions
 AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
 
index 6e915f7fba9d6b6bf780fb353a68bceec295118f..308eb7f5b50d63d183206d5da1e128997848c4bc 100644 (file)
@@ -5,10 +5,7 @@ include_HEADERS = magic.h
 bin_PROGRAMS = file
 
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-AM_CFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-    -Wmissing-declarations -Wredundant-decls -Wnested-externs \
-    -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
-    -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter
+AM_CFLAGS = @WARNINGS@
 
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
        compress.c is_tar.c readelf.c print.c fsmagic.c \
index 5bd08e2ae34aa71738088a5ff14fb7402183591f..bbad83a2d514669834eb33238eda526691a0ccc4 100644 (file)
@@ -27,7 +27,7 @@
  */
 /*
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.105 2008/05/28 21:02:29 christos Exp $
+ * @(#)$File: file.h,v 1.106 2008/07/02 15:22:47 christos Exp $
  */
 
 #ifndef __file_h__
 #endif
 #endif
 
+#ifndef __GNUC__
+#ifndef __attribute__
+#define __attribute__(a)
+#endif
+#endif
+
 #ifndef MIN
 #define        MIN(a,b)        (((a) < (b)) ? (a) : (b))
 #endif