diff mbox series

[FFmpeg-devel] configure: Stop undeffing __STRICT_ANSI__ for mingw/cygwin targets

Message ID 20230526104837.20594-1-martin@martin.st
State New
Headers show
Series [FFmpeg-devel] configure: Stop undeffing __STRICT_ANSI__ for mingw/cygwin targets | expand


Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Martin Storsjö May 26, 2023, 10:48 a.m. UTC
The undeffing of __STRICT_ANSI__ was introduced for mingw in
5666a9f20c6ef2b207e0517c8eeb9556badf76a3 (in March 2011) and for
Cygwin and DOS in a7a187a1beb8551101b592bf85f0f31a0db22f61 (in May

The reason for undeffing it was that it hides some functions which
we might rely on; in particular, strcasecmp was mentioned.

We stopped using the strcasecmp function in November 2011 in
bb3244dee26e3c500b14830e9500cb2d3658f809, by making our own
locale independent version.

Building with both old (not too old for building to fail otherwise)
and current versions of mingw-w64 still seem to work without this.

This avoids a warning with Clang 17 (present since
https://reviews.llvm.org/D144654), warning about undeffing a builtin
macro for each compilation command, with warnings like this:

    In file included from <built-in>:394:
    <command line>:4:8: warning: undefining builtin macro [-Wbuiltin-macro-redefined]

Keep the undef for DOS targets; DJGPP's errno.h omits the definition
of most constants if __STRICT_ANSI__ is defined (but building with
that toolchain fails is somewhat broken anyway).
 configure | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/configure b/configure
index 87f7afc2e1..563a101b64 100755
--- a/configure
+++ b/configure
@@ -5778,7 +5778,7 @@  probe_libc(){
     # MinGW headers can be installed on Cygwin, so check for newlib first.
     elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
         eval ${pfx}libc_type=newlib
-        add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
+        add_${pfx}cppflags -D_XOPEN_SOURCE=600
     # MinGW64 is backwards compatible with MinGW32, so check for it first.
     elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
         eval ${pfx}libc_type=mingw64
@@ -5786,7 +5786,7 @@  probe_libc(){
             add_compat msvcrt/snprintf.o
             add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
-        add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
+        add_${pfx}cppflags -D__USE_MINGW_ANSI_STDIO=1
         eval test \$${pfx_no_}cc_type = "gcc" &&
             add_${pfx}cppflags -D__printf__=__gnu_printf__
         test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
@@ -5798,7 +5798,7 @@  probe_libc(){
         test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
             (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
             die "ERROR: MinGW32 runtime version must be >= 3.15."
-        add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
+        add_${pfx}cppflags -D__USE_MINGW_ANSI_STDIO=1
         test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
             add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
         test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&