Skip to content

Commit 403192a

Browse files
committed
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
2 parents df0c308 + 6a8cbc4 commit 403192a

File tree

6 files changed

+15
-58
lines changed

6 files changed

+15
-58
lines changed

Makefile

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,6 @@ all::
409409
# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
410410
# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
411411
#
412-
# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
413-
# compiles the following initialization:
414-
#
415-
# static const char s[] = ("FOO");
416-
#
417-
# and define it to "no" if you need to remove the parentheses () around the
418-
# constant. The default is "auto", which means to use parentheses if your
419-
# compiler is detected to support it.
420-
#
421412
# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
422413
#
423414
# Define HAVE_GETDELIM if your system has the getdelim() function.
@@ -498,10 +489,9 @@ all::
498489
# setting this flag the exceptions are removed, and all of
499490
# -Wextra is used.
500491
#
501-
# pedantic:
492+
# no-pedantic:
502493
#
503-
# Enable -pedantic compilation. This also disables
504-
# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
494+
# Disable -pedantic compilation.
505495

506496
GIT-VERSION-FILE: FORCE
507497
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1350,14 +1340,6 @@ ifneq (,$(SOCKLEN_T))
13501340
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
13511341
endif
13521342

1353-
ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
1354-
BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
1355-
else
1356-
ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
1357-
BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
1358-
endif
1359-
endif
1360-
13611343
ifeq ($(uname_S),Darwin)
13621344
ifndef NO_FINK
13631345
ifeq ($(shell test -d /sw/lib && echo y),y)

compat/nedmalloc/nedmalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static void threadcache_free(nedpool *p, threadcache *tc, int mymspace, void *me
510510
assert(idx<=THREADCACHEMAXBINS);
511511
if(tck==*binsptr)
512512
{
513-
fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", tck);
513+
fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", (void *)tck);
514514
abort();
515515
}
516516
#ifdef FULLSANITYCHECKS

compat/win32/lazyload.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct proc_addr {
3737
#define INIT_PROC_ADDR(function) \
3838
(function = get_proc_addr(&proc_addr_##function))
3939

40-
static inline void *get_proc_addr(struct proc_addr *proc)
40+
static inline FARPROC get_proc_addr(struct proc_addr *proc)
4141
{
4242
/* only do this once */
4343
if (!proc->initialized) {

config.mak.dev

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
ifndef COMPILER_FEATURES
2+
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
3+
endif
4+
15
ifeq ($(filter no-error,$(DEVOPTS)),)
26
DEVELOPER_CFLAGS += -Werror
37
SPARSE_FLAGS += -Wsparse-error
48
endif
5-
ifneq ($(filter pedantic,$(DEVOPTS)),)
9+
DEVELOPER_CFLAGS += -Wall
10+
ifeq ($(filter no-pedantic,$(DEVOPTS)),)
611
DEVELOPER_CFLAGS += -pedantic
7-
# don't warn for each N_ use
8-
DEVELOPER_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
12+
DEVELOPER_CFLAGS += -Wpedantic
13+
ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
14+
DEVELOPER_CFLAGS += -Wno-pedantic-ms-format
15+
DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
16+
endif
917
endif
10-
DEVELOPER_CFLAGS += -Wall
1118
DEVELOPER_CFLAGS += -Wdeclaration-after-statement
1219
DEVELOPER_CFLAGS += -Wformat-security
1320
DEVELOPER_CFLAGS += -Wold-style-definition
@@ -18,10 +25,6 @@ DEVELOPER_CFLAGS += -Wunused
1825
DEVELOPER_CFLAGS += -Wvla
1926
DEVELOPER_CFLAGS += -fno-common
2027

21-
ifndef COMPILER_FEATURES
22-
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
23-
endif
24-
2528
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
2629
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
2730
endif

gettext.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,7 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)
5555
}
5656

5757
/* Mark msgid for translation but do not translate it. */
58-
#if !USE_PARENS_AROUND_GETTEXT_N
5958
#define N_(msgid) msgid
60-
#else
61-
/*
62-
* Strictly speaking, this will lead to invalid C when
63-
* used this way:
64-
* static const char s[] = N_("FOO");
65-
* which will expand to
66-
* static const char s[] = ("FOO");
67-
* and in valid C, the initializer on the right hand side must
68-
* be without the parentheses. But many compilers do accept it
69-
* as a language extension and it will allow us to catch mistakes
70-
* like:
71-
* static const char *msgs[] = {
72-
* N_("one")
73-
* N_("two"),
74-
* N_("three"),
75-
* NULL
76-
* };
77-
* (notice the missing comma on one of the lines) by forcing
78-
* a compilation error, because parenthesised ("one") ("two")
79-
* will not get silently turned into ("onetwo").
80-
*/
81-
#define N_(msgid) (msgid)
82-
#endif
8359

8460
const char *get_preferred_languages(void);
8561
int is_utf8_locale(void);

git-compat-util.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,10 +1253,6 @@ int warn_on_fopen_errors(const char *path);
12531253
*/
12541254
int open_nofollow(const char *path, int flags);
12551255

1256-
#if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__)
1257-
#define USE_PARENS_AROUND_GETTEXT_N 1
1258-
#endif
1259-
12601256
#ifndef SHELL_PATH
12611257
# define SHELL_PATH "/bin/sh"
12621258
#endif

0 commit comments

Comments
 (0)