Merge branch 'cb/pedantic-build-for-developers'
Update the build procedure to use the "-pedantic" build when DEVELOPER makefile macro is in effect. * cb/pedantic-build-for-developers: developer: enable pedantic by default win32: allow building with pedantic mode enabled gettext: remove optional non-standard parens in N_() definition
This commit is contained in:
22
Makefile
22
Makefile
@ -409,15 +409,6 @@ all::
|
|||||||
# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
|
# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
|
||||||
# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
|
# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
|
||||||
#
|
#
|
||||||
# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
|
|
||||||
# compiles the following initialization:
|
|
||||||
#
|
|
||||||
# static const char s[] = ("FOO");
|
|
||||||
#
|
|
||||||
# and define it to "no" if you need to remove the parentheses () around the
|
|
||||||
# constant. The default is "auto", which means to use parentheses if your
|
|
||||||
# compiler is detected to support it.
|
|
||||||
#
|
|
||||||
# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
|
# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
|
||||||
#
|
#
|
||||||
# Define HAVE_GETDELIM if your system has the getdelim() function.
|
# Define HAVE_GETDELIM if your system has the getdelim() function.
|
||||||
@ -498,10 +489,9 @@ all::
|
|||||||
# setting this flag the exceptions are removed, and all of
|
# setting this flag the exceptions are removed, and all of
|
||||||
# -Wextra is used.
|
# -Wextra is used.
|
||||||
#
|
#
|
||||||
# pedantic:
|
# no-pedantic:
|
||||||
#
|
#
|
||||||
# Enable -pedantic compilation. This also disables
|
# Disable -pedantic compilation.
|
||||||
# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
|
|
||||||
|
|
||||||
GIT-VERSION-FILE: FORCE
|
GIT-VERSION-FILE: FORCE
|
||||||
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
||||||
@ -1350,14 +1340,6 @@ ifneq (,$(SOCKLEN_T))
|
|||||||
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
|
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
|
|
||||||
BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
|
|
||||||
else
|
|
||||||
ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
|
|
||||||
BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(uname_S),Darwin)
|
ifeq ($(uname_S),Darwin)
|
||||||
ifndef NO_FINK
|
ifndef NO_FINK
|
||||||
ifeq ($(shell test -d /sw/lib && echo y),y)
|
ifeq ($(shell test -d /sw/lib && echo y),y)
|
||||||
|
@ -510,7 +510,7 @@ static void threadcache_free(nedpool *p, threadcache *tc, int mymspace, void *me
|
|||||||
assert(idx<=THREADCACHEMAXBINS);
|
assert(idx<=THREADCACHEMAXBINS);
|
||||||
if(tck==*binsptr)
|
if(tck==*binsptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", tck);
|
fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", (void *)tck);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
#ifdef FULLSANITYCHECKS
|
#ifdef FULLSANITYCHECKS
|
||||||
|
@ -37,7 +37,7 @@ struct proc_addr {
|
|||||||
#define INIT_PROC_ADDR(function) \
|
#define INIT_PROC_ADDR(function) \
|
||||||
(function = get_proc_addr(&proc_addr_##function))
|
(function = get_proc_addr(&proc_addr_##function))
|
||||||
|
|
||||||
static inline void *get_proc_addr(struct proc_addr *proc)
|
static inline FARPROC get_proc_addr(struct proc_addr *proc)
|
||||||
{
|
{
|
||||||
/* only do this once */
|
/* only do this once */
|
||||||
if (!proc->initialized) {
|
if (!proc->initialized) {
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
|
ifndef COMPILER_FEATURES
|
||||||
|
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(filter no-error,$(DEVOPTS)),)
|
ifeq ($(filter no-error,$(DEVOPTS)),)
|
||||||
DEVELOPER_CFLAGS += -Werror
|
DEVELOPER_CFLAGS += -Werror
|
||||||
SPARSE_FLAGS += -Wsparse-error
|
SPARSE_FLAGS += -Wsparse-error
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter pedantic,$(DEVOPTS)),)
|
|
||||||
DEVELOPER_CFLAGS += -pedantic
|
|
||||||
# don't warn for each N_ use
|
|
||||||
DEVELOPER_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
|
||||||
endif
|
|
||||||
DEVELOPER_CFLAGS += -Wall
|
DEVELOPER_CFLAGS += -Wall
|
||||||
|
ifeq ($(filter no-pedantic,$(DEVOPTS)),)
|
||||||
|
DEVELOPER_CFLAGS += -pedantic
|
||||||
|
DEVELOPER_CFLAGS += -Wpedantic
|
||||||
|
ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
|
||||||
|
DEVELOPER_CFLAGS += -Wno-pedantic-ms-format
|
||||||
|
DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
|
||||||
|
endif
|
||||||
|
endif
|
||||||
DEVELOPER_CFLAGS += -Wdeclaration-after-statement
|
DEVELOPER_CFLAGS += -Wdeclaration-after-statement
|
||||||
DEVELOPER_CFLAGS += -Wformat-security
|
DEVELOPER_CFLAGS += -Wformat-security
|
||||||
DEVELOPER_CFLAGS += -Wold-style-definition
|
DEVELOPER_CFLAGS += -Wold-style-definition
|
||||||
@ -18,10 +25,6 @@ DEVELOPER_CFLAGS += -Wunused
|
|||||||
DEVELOPER_CFLAGS += -Wvla
|
DEVELOPER_CFLAGS += -Wvla
|
||||||
DEVELOPER_CFLAGS += -fno-common
|
DEVELOPER_CFLAGS += -fno-common
|
||||||
|
|
||||||
ifndef COMPILER_FEATURES
|
|
||||||
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
||||||
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
|
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
|
||||||
endif
|
endif
|
||||||
|
24
gettext.h
24
gettext.h
@ -55,31 +55,7 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Mark msgid for translation but do not translate it. */
|
/* Mark msgid for translation but do not translate it. */
|
||||||
#if !USE_PARENS_AROUND_GETTEXT_N
|
|
||||||
#define N_(msgid) msgid
|
#define N_(msgid) msgid
|
||||||
#else
|
|
||||||
/*
|
|
||||||
* Strictly speaking, this will lead to invalid C when
|
|
||||||
* used this way:
|
|
||||||
* static const char s[] = N_("FOO");
|
|
||||||
* which will expand to
|
|
||||||
* static const char s[] = ("FOO");
|
|
||||||
* and in valid C, the initializer on the right hand side must
|
|
||||||
* be without the parentheses. But many compilers do accept it
|
|
||||||
* as a language extension and it will allow us to catch mistakes
|
|
||||||
* like:
|
|
||||||
* static const char *msgs[] = {
|
|
||||||
* N_("one")
|
|
||||||
* N_("two"),
|
|
||||||
* N_("three"),
|
|
||||||
* NULL
|
|
||||||
* };
|
|
||||||
* (notice the missing comma on one of the lines) by forcing
|
|
||||||
* a compilation error, because parenthesised ("one") ("two")
|
|
||||||
* will not get silently turned into ("onetwo").
|
|
||||||
*/
|
|
||||||
#define N_(msgid) (msgid)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *get_preferred_languages(void);
|
const char *get_preferred_languages(void);
|
||||||
int is_utf8_locale(void);
|
int is_utf8_locale(void);
|
||||||
|
@ -1253,10 +1253,6 @@ int warn_on_fopen_errors(const char *path);
|
|||||||
*/
|
*/
|
||||||
int open_nofollow(const char *path, int flags);
|
int open_nofollow(const char *path, int flags);
|
||||||
|
|
||||||
#if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__)
|
|
||||||
#define USE_PARENS_AROUND_GETTEXT_N 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SHELL_PATH
|
#ifndef SHELL_PATH
|
||||||
# define SHELL_PATH "/bin/sh"
|
# define SHELL_PATH "/bin/sh"
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user