diff --git a/Makefile b/Makefile index b8c261be..3bf15c1f 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ mandir ?= $(prefix)/man CC ?= gcc XCFLAGS ?= -CFLAGS ?= -O2 -ggdb3 -Wall -Werror -Wno-unused-parameter +CFLAGS ?= -O2 -ggdb3 -Wall -Werror -Wno-unused-parameter -DNDEBUG=1 CFLAGS += -pthread $(XCFLAGS) ######################################################################## diff --git a/reopen.h b/reopen.h index b5c85b66..bbc2fd4b 100644 --- a/reopen.h +++ b/reopen.h @@ -82,7 +82,7 @@ #endif /* __must_check_result */ #ifndef __hot -# if defined(__GNUC__) && !defined(__clang__) +# if defined(NDEBUG) && (defined(__GNUC__) && !defined(__clang__)) # define __hot __attribute__((hot, optimize("O3"))) # else # define __hot @@ -90,7 +90,7 @@ #endif /* __hot */ #ifndef __cold -# if defined(__GNUC__) && !defined(__clang__) +# if defined(NDEBUG) && (defined(__GNUC__) && !defined(__clang__)) # define __cold __attribute__((cold, optimize("Os"))) # elif defined(__GNUC__) /* cland case, just put infrequently used functions in separate section */ @@ -101,7 +101,7 @@ #endif /* __cold */ #ifndef __flatten -# if defined(__GNUC__) || defined(__clang__) +# if defined(NDEBUG) && (defined(__GNUC__) || defined(__clang__)) # define __flatten __attribute__((flatten)) # else # define __flatten