From e392454c2667192486be001bf77b3cb773d4743d Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Tue, 30 Jun 2020 15:00:02 +0000 Subject: [PATCH] Add PEDANTIC and CONFIG_PEDANTIC to compile as standard c11 if desired. Usage: make [-jN] PEDANTIC=1 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12760 d7cf8633-e32d-0410-b094-e92efae38249 --- makefile.inc | 8 ++++++-- prvm_exec.c | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/makefile.inc b/makefile.inc index 2d83af48..fd5792d6 100644 --- a/makefile.inc +++ b/makefile.inc @@ -172,8 +172,12 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMM # Compilation -CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_SND_XMP) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../ -# CFLAGS_STANDARD=-D_POSIX_C_SOURCE=200112L -std=c11 -pedantic +ifeq ($(PEDANTIC),1) + CFLAGS_STANDARD=-std=c11 -pedantic -D_POSIX_C_SOURCE=200809L -DCONFIG_PEDANTIC +else + CFLAGS_STANDARD= +endif +CFLAGS_COMMON=$(CFLAGS_STANDARD) $(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_SND_XMP) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../ CFLAGS_CLIENT=-DCONFIG_MENU $(CFLAGS_VIDEO_CAPTURE) CFLAGS_SERVER= CFLAGS_DEBUG=-ggdb diff --git a/prvm_exec.c b/prvm_exec.c index b6766757..d4cf0d83 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -716,8 +716,10 @@ static void PRVM_StatementCoverageEvent(prvm_prog_t *prog, mfunction_t *func, in Con_Printf("prvm_coverage: %s just executed a statement at %s for the first time. Coverage: %.2f%%.\n", prog->name, PRVM_WhereAmI(vabuf, sizeof(vabuf), prog, func, statement), prog->statements_covered * 100.0 / prog->numstatements); } -#if defined (__GNUC__) && (_GNU_SOURCE) -#define HAVE_COMPUTED_GOTOS 1 +#if defined (__GNUC__) || (__clang__) +# ifndef CONFIG_PEDANTIC +# define HAVE_COMPUTED_GOTOS 1 +# endif #endif #define OPA ((prvm_eval_t *)&prog->globals.fp[st->operand[0]]) -- 2.39.2