Skip to content

Commit 643ac49

Browse files
committed
Set default C/C++ standards in configure script
Also move some maintainer specific compile flags to the default set in the configure script. These flags were meant to enforce following the standards pedantically and therefore only used in maintainer mode, but it doesn't hurt to always apply them as the code is meant to be free of warnings/errors caused by these flags. Also remove the specific -std=c99 flag for runguard, since the default c11 supersedes it. See the original commit d76a618 that added it.
1 parent 1dcc2a9 commit 643ac49

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ paths.mk:
193193
@exit 1
194194

195195
# Configure for running in source tree, not meant for normal use:
196-
MAINT_CXFLAGS=-g -O1 -Wall -fstack-protector -D_FORTIFY_SOURCE=2 \
197-
-fPIE -Wformat -Wformat-security -pedantic
198-
MAINT_LDFLAGS=-fPIE -pie -Wl,-z,relro -Wl,-z,now
199196
maintainer-conf: inplace-conf-common composer-dependencies-dev webapp/.env.local
200197
inplace-conf: inplace-conf-common composer-dependencies
201198
inplace-conf-common: dist
@@ -212,9 +209,6 @@ inplace-conf-common: dist
212209
--with-judgehost_judgedir=$(CURDIR)/output/judgings \
213210
--with-domserver_databasedumpdir=$(CURDIR)/output/db-dumps \
214211
--with-baseurl='http://localhost/domjudge/' \
215-
CFLAGS='$(MAINT_CXFLAGS) -std=c11' \
216-
CXXFLAGS='$(MAINT_CXFLAGS) -std=c++11' \
217-
LDFLAGS='$(MAINT_LDFLAGS)' \
218212
$(CONFIGURE_FLAGS)
219213

220214
# Run Symfony in dev mode (for maintainer-mode):

configure.ac

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,23 @@ if test "x$JUDGEHOST_BUILD_ENABLED" = xyes; then
5151
eval enable_${flag}_setting=$res
5252
AC_MSG_RESULT($res)
5353
done
54-
54+
5555
DEF_CXFLAGS="-g -O2"
5656
DEF_LDFLAGS=""
57-
57+
5858
AX_APPEND_COMPILE_FLAGS(-Wall, DEF_CXFLAGS)
59+
AX_APPEND_COMPILE_FLAGS(-Wformat, DEF_CXFLAGS)
60+
AX_APPEND_COMPILE_FLAGS(-Wformat-security, DEF_CXFLAGS)
61+
AX_APPEND_COMPILE_FLAGS(-pedantic, DEF_CXFLAGS)
5962
AX_APPEND_COMPILE_FLAGS(-fstack-protector, DEF_CXFLAGS)
6063
AX_APPEND_COMPILE_FLAGS(-fPIE, DEF_CXFLAGS)
6164
AX_APPEND_COMPILE_FLAGS(-D_FORTIFY_SOURCE=2, DEF_CXFLAGS)
6265
AX_APPEND_LINK_FLAGS([-fPIE -pie], DEF_LDFLAGS)
6366
AX_APPEND_LINK_FLAGS([-Wl,-z,relro], DEF_LDFLAGS)
6467
AX_APPEND_LINK_FLAGS([-Wl,-z,now], DEF_LDFLAGS)
65-
66-
test "x$enable_CFLAGS_setting" = xyes && AC_SUBST(CFLAGS, $DEF_CXFLAGS)
67-
test "x$enable_CXXFLAGS_setting" = xyes && AC_SUBST(CXXFLAGS, $DEF_CXFLAGS)
68+
69+
test "x$enable_CFLAGS_setting" = xyes && AC_SUBST(CFLAGS, "$DEF_CXFLAGS -std=c11")
70+
test "x$enable_CXXFLAGS_setting" = xyes && AC_SUBST(CXXFLAGS, "$DEF_CXFLAGS -std=c++11")
6871
test "x$enable_LDFLAGS_setting" = xyes && AC_SUBST(LDFLAGS, $DEF_LDFLAGS)
6972
fi
7073

@@ -94,7 +97,7 @@ if test "x$DOMSERVER_BUILD_ENABLED" = xyes; then
9497
AC_MSG_CHECKING([webserver-group])
9598
AC_ARG_WITH([webserver-group], [AS_HELP_STRING([--with-webserver-group=GROUP],
9699
[Webserver group for password files (default: try to detect).])], [], [])
97-
100+
98101
if test "x$with_webserver_group" = x; then
99102
# Try a number of group names and choose first one found
100103
found=0

judge/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ $(SUBST_FILES): %: %.in $(TOPDIR)/paths.mk
1616
runguard: LDFLAGS := $(filter-out -pie,$(LDFLAGS))
1717

1818
runguard: -lm $(LIBCGROUP)
19-
runguard: CFLAGS += -std=c99
2019
runguard$(OBJEXT): $(TOPDIR)/etc/runguard-config.h
2120

2221
evict: evict.c $(LIBHEADERS) $(LIBSOURCES)

0 commit comments

Comments
 (0)