From 2b136f47acab03f7ab9e1d08810414af8759e98a Mon Sep 17 00:00:00 2001 From: Zurab Kvachadze Date: Wed, 19 Nov 2025 20:05:25 +0100 Subject: [PATCH] auto/{cc,options}: Removed unnecessary compiler flags The build system should not unconditionally set compilation flag that vary a lot between each user and, as a result, are meant to be toggled individually by distribution/developer/end user. Among these flags are the options that control program optimisation, debug symbols, the `-pipe` options and `-Werror`. `-Werror` might be harmful since compilers continuously add warnings so the users of new compilers may unexpectedly fail to compile njs since `-Werror` is set. The compilation flags should be supplied in the standard CFLAGS environment variable. Signed-off-by: Zurab Kvachadze --- auto/cc | 24 ------------------------ auto/options | 4 ++-- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/auto/cc b/auto/cc index 8a615ec4a..d4b284895 100644 --- a/auto/cc +++ b/auto/cc @@ -64,7 +64,6 @@ case $NJS_CC_NAME in gcc) njs_define=NJS_GCC . auto/define - NJS_CFLAGS="$NJS_CFLAGS -pipe" NJS_CFLAGS="$NJS_CFLAGS -fPIC" # Do not export symbols except explicitly marked with NJS_EXPORT. @@ -72,9 +71,6 @@ case $NJS_CC_NAME in # c99/gnu99 conflict with Solaris XOPEN. #NJS_CFLAGS="$NJS_CFLAGS -std=gnu99" - - NJS_CFLAGS="$NJS_CFLAGS -O" - #NJS_CFLAGS="$NJS_CFLAGS -O0" NJS_CFLAGS="$NJS_CFLAGS -W -Wall -Wextra" #NJS_CFLAGS="$NJS_CFLAGS -Wunused-result" @@ -94,12 +90,6 @@ case $NJS_CC_NAME in NJS_CFLAGS="$NJS_CFLAGS -Wmissing-prototypes" - # Stop on warning. - NJS_CFLAGS="$NJS_CFLAGS -Werror" - - # Debug. - NJS_CFLAGS="$NJS_CFLAGS -g" - if [ "$NJS_ADDRESS_SANITIZER" = "YES" ]; then NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address" NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer" @@ -109,14 +99,11 @@ case $NJS_CC_NAME in clang) njs_define=NJS_CLANG . auto/define - NJS_CFLAGS="$NJS_CFLAGS -pipe" NJS_CFLAGS="$NJS_CFLAGS -fPIC" # Do not export symbols except explicitly marked with NJS_EXPORT. NJS_CFLAGS="$NJS_CFLAGS -fvisibility=hidden" - NJS_CFLAGS="$NJS_CFLAGS -O" - #NJS_CFLAGS="$NJS_CFLAGS -O0" NJS_CFLAGS="$NJS_CFLAGS -W -Wall -Wextra" #NJS_CFLAGS="$NJS_CFLAGS -Wunused-result" @@ -130,17 +117,6 @@ case $NJS_CC_NAME in NJS_CFLAGS="$NJS_CFLAGS -Wmissing-prototypes" - # Stop on warning. - NJS_CFLAGS="$NJS_CFLAGS -Werror" - - # Debug. - - if [ "$NJS_SYSTEM_PLATFORM" != "powerpc" ]; then - # "-g" flag causes the "unknown pseudo-op: `.cfi_sections'" - # error on PowerPC Clang. - NJS_CFLAGS="$NJS_CFLAGS -g" - fi - if [ "$NJS_ADDRESS_SANITIZER" = "YES" ]; then NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address" NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer" diff --git a/auto/options b/auto/options index 0a4dc6c74..c33990621 100644 --- a/auto/options +++ b/auto/options @@ -3,8 +3,8 @@ # Copyright (C) NGINX, Inc. -NJS_CC_OPT=${NJS_CC_OPT:--O} -NJS_LD_OPT=${NJS_CC_OPT:--O} +NJS_CC_OPT= +NJS_LD_OPT= NJS_DEBUG=NO NJS_DEBUG_MEMORY=NO