Commit Graph

74 Commits

Author SHA1 Message Date
Jonathan Yong
dc42231f03 _mingw_mac.h: bump to 13.x
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2024-05-29 02:40:37 +00:00
Martin Storsjö
05598db991 headers: Use reserved name for printf/scanf format attribute types
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-17 10:19:00 +03:00
Martin Storsjö
3599f2fca7 headers: Don't use the ms_printf/scanf and gnu_printf/scanf format attributes with clang
Clang doesn't support the ms_printf/scanf and gnu_printf/scanf
format attributes, only plain "printf" and "scanf".

We already expand e.g. __MINGW_PRINTF_FORMAT (which differs depending
on __USE_MINGW_ANSI_STDIO) into plain "printf" for Clang, since
015e637b4b. However, a number
of functions explicitly declared either gnu or ms style formats,
which caused these functions to not get any format string diagnostics.

This fixes https://github.com/llvm/llvm-project/issues/68995,
which reported that no warnings are produced for mismatched
printf/scanf format strings, when compiling with Clang, with
a toolchain targeting msvcrt (i.e. in practice using
__USE_MINGW_ANSI_STDIO enabled).

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-17 10:18:57 +03:00
Martin Storsjö
8c13b28ace headers: Stop using the __mingw_static_ovr macro
We should prefer using a macro which doesn't declare functions
as static inline in C++ mode.

This macro was added in bc6a874889,
without an explanation of why it was added.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 23:52:41 +03:00
Christian Franke
f8e088eb19 Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined
This prevents bogus warnings or build aborts (-Werror) if Windows
includes are used on Cygwin.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-02-21 22:33:43 +08:00
Jonathan Yong
a08e769015 mingw-w64-headers: bump _mingw_mac.h to 12.0.0
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2023-04-28 11:23:22 +00:00
Christian Franke
a1c25fbd1a headers: _FORTIFY_SOURCE: Use __has_builtin() instead of version check
Check for support of __builtin_dynamic_object_size() and
__builtin_va_arg_pack() with __has_builtin().

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-02-09 10:38:50 +02:00
Christian Franke
e34c747fa6 headers: Add support for _FORTIFY_SOURCE=3
If specified, __builtin_dynamic_object_size() is used instead of
__builtin_object_size() if supported (GCC 12.0 or later).
This enables buffer overflow checks if the buffer size is non-const
but known during runtime.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-02-03 11:54:06 +08:00
Martin Storsjö
22a065d89f headers: Clarify a few aspects relating to Clang wrt the fortification macros
There's no problem in using the "artificial" attribute with Clang,
at least as of Clang 10.0.

Clarify why Clang is excluded for __MINGW_FORTIFY_VA_ARG.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-11-07 01:03:24 +02:00
Jonathan Yong
28db59687e
mingw-w64-headers: bump _mingw_mac.h to 11.0.0
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2022-04-04 10:23:51 +00:00
Martin Storsjö
bbf8ca00fb headers: Enable WIDL_EXPLICIT_AGGREGATE_RETURNS on arm/aarch64 too
While clang does match MSVC with regards to aggregate returns, when
run in MSVC mode, it matches GCC when run in mingw mode - and the
same behaviour extends to arm/aarch64 too.

Thus, this workaround needs to be enabled on all architectures,
not only on x86.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-02-08 12:45:23 +02:00
Liu Hao
cb37f01f9c headers/locale: Make result of localeconv() accord to GCC's -funsigned-char option
This enables the old behavior when `-funsigned-char` is specified.

The `selectany` attribute is assumed to be supported since GCC 4.2, and
probably by Clang as well.

This test program should print 127 when `char` is signed and 255 when it
is unsigned:

  #include <stdio.h>
  #include <locale.h>

  int main(void)
    {
      struct lconv* lc = localeconv();
      printf("frac_digits = %d\n", lc->frac_digits);
    }

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/37300502/
Reference: https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Variable-Attributes.html
Signed-off-by: Liu Hao <lh_mouse@126.com>
2021-06-14 19:27:13 +08:00
Jonathan Yong
788f577019
mingw-w64-headers: bump _mingw_mac.h to 10.0.0
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2021-05-22 14:06:18 +00:00
Jonathan Yong
2732d54d8c
mingw-w64-headers: bump _mingw_mac.h to 9.0.0
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2020-09-18 09:54:04 +00:00
Jonathan Yong
905f11f851 _mingw_mac.h: bump to 8.x
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2019-11-09 06:20:14 +00:00
Christian Franke
a1b157556d headers: _FORTIFY_SOURCE: Allow to limit level for individual functions.
Add parameter 'maxtype' to __mingw_bos*() macros.  Allows to force usage
of __builtin_object_size(p, 0) even if _FORTIFY_SOURCE=2 is set.

Signed-off-by: Liu Hao <lh_mouse@126.com>
2019-10-10 22:42:29 +08:00
Christian Franke
1e6e3429c6 headers: _FORTIFY_SOURCE: Allow to disable usage of __builtin_va_arg_pack().
_FORTIFY_VA_ARG=0 disables inline functions with __builtin_va_arg_pack().
This allows _FORTIFY_SOURCE also in the rare case that the address of a
s*printf() function is used.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: Liu Hao <lh_mouse@126.com>
2019-09-28 22:35:25 +08:00
Christian Franke
505de9b6e1 headers: _FORTIFY_SOURCE: Use __builtin_va_arg_pack() only if needed.
GCC may report an error if the address of an inline function with
_buildin_va_arg_pack() is used.  Keep the old inline functions if
_FORTIFY_SOURCE is disabled.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2019-09-27 22:27:33 +03:00
Christian Franke
db643423ae _FORTIFY_SOURCE: Fix usage of __gnu_inline__.
Always use '__gnu_inline__' with 'extern inline __always_inline__'.
This avoids generation of bogus non-inline functions if function
address is used.

Don't use '__gnu_inline__' with 'static inline' or C++ 'inline'.
This avoids undefined symbols if function address is used.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2019-09-12 22:31:54 +03:00
Martin Storsjö
94efbac6cd headers: Don't use __gnu_inline__ with __mingw_ovr in C++ mode
In C++ mode, __mingw_ovr is a plain "inline" without "static".

Clang emits a standalone (non-comdat) copy of functions in C++ for
the combination of non-static inline (without extern) and __gnu_inline__,
leading to multiple definitions of symbols.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-09-04 09:59:21 +03:00
Christian Franke
b4a4588bd5 crt: Add support for _FORTIFY_SOURCE.
Signed-off-by: Liu Hao <lh_mouse@126.com>
2019-09-02 22:05:34 +08:00
Jacek Caban
a91a7e4057 _mingw_mac.h: Enable WIDL_EXPLICIT_AGGREGATE_RETURNS workaround for ABI incompatibility on affected platforms 2018-10-26 15:36:50 +02:00
Jonathan Yong
69c8fad697
mingw-w64-headers: Bump __MINGW64_VERSION_MAJOR for new release
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2018-09-16 14:39:16 +00:00
Martin Storsjö
6741692ee8 headers: Make sure _ARM64_ is defined in _mingw_mac.h as well
setjmp.h only checks for _ARM64_, not for __aarch64__, but so far,
only winnt.h defined this. Since _mingw_mac.h also defines some of
the defines that winnt.h does (like _ARM_), do the same for _ARM64_.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-12-10 23:14:59 +02:00
niXman
4b197905d2 __MINGW64_VERSION_BUGFIX 2017-11-20 08:37:12 +02:00
Martell Malone
55f4a99b45 headers: correct value of _M_IX86 based on arch
different variations of -march can be passed to the compiler.
this also fixes building winpthreads  when __i686__ is not present.
2017-11-13 05:58:34 +00:00
Martin Storsjö
9ffd823a9a headers: Define _M_ARM64 just like MSVC does
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-11-07 22:44:10 +02:00
Martin Storsjö
bc6a874889 crt: Add compat wrappers for adapting the CRT startup and libmingwex to ucrtbase.dll
This intercepts the function calls that the mingw CRT startup and
other libmingwex helpers expect to use, that no longer is available on
ucrtbase.dll.

This allows using the same CRT startup object files and libmingwex both
with the normal msvcrt.dll and with ucrtbase.dll, instead of having to
rebuild them depending on which target is to be used.

Adjust the headers to make some of the inline functions static in C++
builds as well; this fixes issues with duplicate symbols where the
non-static inline function (in C++ builds) would conflict with the
CRT compat fallbacks.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-09-23 17:24:59 +03:00
Martell Malone
d8c0165e41 crt: fix _MINGW_UDERSCORE_PREFIX for arm 2015-12-01 23:50:37 -08:00
Jonathan Yong
ba1da4ac85 bump for 5.0 2015-01-25 08:39:01 +08:00
Jonathan Yong
a2bdd3751d
First 4.0 release 2015-01-25 08:37:15 +08:00
Kai Tietz
eb02609fb6 Increase version number on trunk to 4.0
Do further optimization for math-inlines to avoid for long double types unnecessary load/store via x87 instructions.


git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@6304 4407c894-4637-0410-b4f5-ada5f102cad1
2013-09-21 08:57:55 +00:00
niXman
0695eeb4b0 cosmetic formatting only
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@6248 4407c894-4637-0410-b4f5-ada5f102cad1
2013-09-08 19:34:55 +00:00
Kai Tietz
62d34db0a5 Make sure that mingw's extension is defined as empty macro for widl-mode.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@6168 4407c894-4637-0410-b4f5-ada5f102cad1
2013-08-30 09:14:10 +00:00
Jacek Caban
42439ed017 Use the usual wrappers for *_output_format functions.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5897 4407c894-4637-0410-b4f5-ada5f102cad1
2013-06-14 16:03:20 +00:00
Kai Tietz
87474a7038 Add _M_ARM and _ARM_ define
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5629 4407c894-4637-0410-b4f5-ada5f102cad1
2013-03-10 12:46:48 +00:00
Jonathan Yong
73e50d0577 New printf/scanf attribute helper macros
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5538 4407c894-4637-0410-b4f5-ada5f102cad1
2013-01-11 16:23:05 +00:00
Jonathan Yong
e09effa2fc strtod C compliant aliases
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5537 4407c894-4637-0410-b4f5-ada5f102cad1
2013-01-11 16:20:29 +00:00
Kai Tietz
d26ac7edee Add some comment to new macro
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5524 4407c894-4637-0410-b4f5-ada5f102cad1
2013-01-02 15:46:30 +00:00
Kai Tietz
aadc416a3b let release-counter start at one.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5523 4407c894-4637-0410-b4f5-ada5f102cad1
2013-01-02 15:05:35 +00:00
Kai Tietz
d48325d5d5 Add new macro __MINGW64_VERSION_RC which has to be bumped for serious
new features / bug-fixes.  By this we can provide users a chance to detect
proper runtime-version in headers.


git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5522 4407c894-4637-0410-b4f5-ada5f102cad1
2013-01-02 15:00:55 +00:00
Corinna Vinschen
6b45ef6532 * _mingw_mac.h (__MSABI_LONG): Define for LP64 systems as well.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5233 4407c894-4637-0410-b4f5-ada5f102cad1
2012-07-17 15:23:54 +00:00
Ozkan Sezer
56bc9b612c * _mingw_mac.h (__MINGW_GCC_VERSION): New macro.
* setjmp.h (setjmp): Use mingw_getsp() with gcc < 4.7.2.

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5163 4407c894-4637-0410-b4f5-ada5f102cad1
2012-07-04 16:32:22 +00:00
Rafaël Carré
8a67ab4541 Replace 'w64 mingw-runtime' by 'mingw-w64 runtime'
Also replace 'This file is a part of' by 'This file is part of' for consistency

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5147 4407c894-4637-0410-b4f5-ada5f102cad1
2012-06-28 15:40:59 +00:00
Jacek Caban
bfa8f779ac _mingw_mac.h: Added __C89_NAMELESSSTRUCTNAME* and __C89_NAMELESSUNIONNAME* macros
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5010 4407c894-4637-0410-b4f5-ada5f102cad1
2012-05-15 10:06:51 +00:00
Jacek Caban
be6c649191 Moved *_PREREQ macros to _mingw_mac.h, where they are used
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@4765 4407c894-4637-0410-b4f5-ada5f102cad1
2012-01-26 12:37:19 +00:00
Jonathan Yong
772b6f8da3 Move crt secure macros and fix fallback cases
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@4736 4407c894-4637-0410-b4f5-ada5f102cad1
2012-01-12 14:31:19 +00:00
Jacek Caban
9ff1fccbd4 _mingw_mac.h: Added missing extern "C++" around __if_array
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@4734 4407c894-4637-0410-b4f5-ada5f102cad1
2012-01-11 17:07:21 +00:00
Jonathan Yong
fd60538911 Fix macro arguments
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@4731 4407c894-4637-0410-b4f5-ada5f102cad1
2012-01-11 13:49:10 +00:00
Jonathan Yong
d7513bfe50 Fix counts
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@4730 4407c894-4637-0410-b4f5-ada5f102cad1
2012-01-11 12:58:09 +00:00