aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2012-09-21 01:42:03 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2012-09-21 01:42:03 +0000
commitabc482e578333f820bba559ce183cb71879e8c72 (patch)
tree11d08bc5430aee50bb94f35607d0f4d9e084f49c
parent383467b2b3ab7f5779c399c1af49074b16722b45 (diff)
Revert r45018 and r45019: put config.h back in lemon.c and take _U_ back off
the compile line when building with cmake. Put _U_'s definition in config.h when building with autofoo and on Windows. svn path=/trunk/; revision=45034
-rw-r--r--config.h.win325
-rw-r--r--config.nmake2
-rw-r--r--configure.ac15
-rw-r--r--tools/lemon/CMakeLists.txt6
-rw-r--r--tools/lemon/lemon.c3
5 files changed, 16 insertions, 15 deletions
diff --git a/config.h.win32 b/config.h.win32
index 3c59ad23d2..67d7eeec71 100644
--- a/config.h.win32
+++ b/config.h.win32
@@ -236,6 +236,11 @@
#define WIN32 1
#endif
+/* Wireshark's marker that a function parameter is unused. Used to avoid
+ * warnings on compilers that support such hints.
+ */
+#define _U_
+
/* Visual C 9 (2008), Visual C 10 (2010) and Visual C 11 (2012) need these prototypes */
/* XXX: Can we use MSC_VER >= 1500 ?? */
#if _MSC_VER == 1500 || _MSC_VER == 1600 || _MSC_VER == 1700
diff --git a/config.nmake b/config.nmake
index 4c70b52ff3..ea1ab1d211 100644
--- a/config.nmake
+++ b/config.nmake
@@ -836,7 +836,7 @@ LOCAL_CFLAGS= $(LOCAL_CFLAGS) /analyze:WX-
!ENDIF
#STANDARD_CFLAGS are flags used for *Wireshark* compiles (not stuff like lemon, etc)
-STANDARD_CFLAGS=-DHAVE_CONFIG_H -D_U_="" /DPCAP_VERSION=$(PCAP_VERSION) $(LOCAL_CFLAGS) $(WARNINGS_CFLAGS)
+STANDARD_CFLAGS=-DHAVE_CONFIG_H /DPCAP_VERSION=$(PCAP_VERSION) $(LOCAL_CFLAGS) $(WARNINGS_CFLAGS)
# Optional: Define WIRESHARK_GENERATE_BSC_FILE to generate .sbr files for input to bscmake
!IFDEF WIRESHARK_GENERATE_BSC_FILE
diff --git a/configure.ac b/configure.ac
index fe9ab80566..2df0612c90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,18 +449,17 @@ AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
# AC_WIRESHARK_LDFLAGS_CHECK([-fwhole-program])
#
-# If we're running GCC or clang, add '-D_U_="__attribute__((unused))"' to
-# CPPFLAGS as well, so we can use _U_ to flag unused function arguments and
-# not get warnings about them. Otherwise, add '-D_U_=""', so that _U_ used
-# to flag an unused function argument will compile with non-GCC, non-clang
-# compilers.
+# If we're running GCC or clang define _U_ to be "__attribute__((unused))"
+# so we can use _U_ to flag unused function parameters and not get warnings
+# about them. Otherwise, define _U_ to be an empty string so that _U_ used
+# to flag an unused function parameters will compile with other compilers.
#
-# XXX - other compilers?
+# XXX - similar hints for other compilers?
#
if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
- CPPFLAGS="-D_U_=\"__attribute__((unused))\" $CPPFLAGS"
+ AC_DEFINE(_U_, __attribute__((unused)), [Hint to the compiler that a function parameters is not used])
else
- CPPFLAGS="-D_U_=\"\" $CPPFLAGS"
+ AC_DEFINE(_U_, , [Hint to the compiler that a function parameters is not used])
fi
# If we're running GCC or CLang, use FORTIFY_SOURCE=2
diff --git a/tools/lemon/CMakeLists.txt b/tools/lemon/CMakeLists.txt
index ebcf451d10..a6c53372c2 100644
--- a/tools/lemon/CMakeLists.txt
+++ b/tools/lemon/CMakeLists.txt
@@ -41,12 +41,6 @@ set(lemon_LIBS
# Do we need something here on any platform?
)
-if(CMAKE_COMPILER_IS_GNUCC)
- add_definitions(-D_U_=__attribute__\(\(unused\)\))
-else()
- add_definitions(-D_U_=)
-endif()
-
add_executable(lemon ${lemon_FILES})
target_link_libraries(lemon ${lemon_LIBS})
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c
index ee4b47df90..f075243c23 100644
--- a/tools/lemon/lemon.c
+++ b/tools/lemon/lemon.c
@@ -28,6 +28,9 @@
** Updated to sqlite lemon version 1.59
** $Id$
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <stdio.h>
#include <stdarg.h>