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
This commit is contained in:
Jeff Morriss 2012-09-21 01:42:03 +00:00
parent 383467b2b3
commit abc482e578
5 changed files with 16 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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})

View File

@ -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>