Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] configure: Stop undeffing __STRICT_ANSI__ for mingw/cygwin targets
@ 2023-05-26 10:48 Martin Storsjö
  0 siblings, 0 replies; only message in thread
From: Martin Storsjö @ 2023-05-26 10:48 UTC (permalink / raw)
  To: ffmpeg-devel

The undeffing of __STRICT_ANSI__ was introduced for mingw in
5666a9f20c6ef2b207e0517c8eeb9556badf76a3 (in March 2011) and for
Cygwin and DOS in a7a187a1beb8551101b592bf85f0f31a0db22f61 (in May
2011).

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 --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"
         fi
-        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" &&
-- 
2.37.1 (Apple Git-137.1)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-26 10:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 10:48 [FFmpeg-devel] [PATCH] configure: Stop undeffing __STRICT_ANSI__ for mingw/cygwin targets Martin Storsjö

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git