Because the C11 and C++11 standards override the previous C99 standard, usage of the __STDC_FORMAT_MACROS macro was altered in <inttypes.h> to enable the macros for format specifiers within C++, and usage of the __STDC_LIMIT_MACROS macro and the __STDC_CONSTANT_MACROS macro was altered in <stdint.h> to enable the macros for limits of integer types within C++. As a result, the macros within <inttypes.h> and <stdint.h> are now unconditionally defined for both C and C++ if _cplusplus >= 201103L

This commit is contained in:
Kalamatee 2023-04-10 14:03:24 +01:00 committed by deadwood
parent e2f9a76f96
commit aff6c19e3b
2 changed files with 15 additions and 7 deletions

View File

@ -2,7 +2,7 @@
#define _STDC_INTTYPES_H_
/*
Copyright © 1995-2018, The AROS Development Team. All rights reserved.
Copyright © 1995-2023, The AROS Development Team. All rights reserved.
$Id$
C99 header file inttypes.h with standard fixed sized integral types.
@ -11,9 +11,13 @@
#include <aros/system.h>
#include <stdint.h>
#if defined __cplusplus && __cplusplus < 201103L
# define __STDC_NEEDS_DEFINES
#endif
#define __BIT_TYPES_DEFINED__
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
#if !defined(__STDC_NEEDS_DEFINES) || defined(__STDC_FORMAT_MACROS)
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 1995-2015, The AROS Development Team. All rights reserved.
Copyright (C) 1995-2023, The AROS Development Team. All rights reserved.
Desc: C99 header file stdint.h
Standard fixed sized integral types.
@ -12,7 +12,11 @@
#include <aros/types/intptr_t.h>
#include <aros/types/uintptr_t.h>
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
#if defined __cplusplus && __cplusplus < 201103L
# define __STDC_NEEDS_DEFINES
#endif
#if !defined(__STDC_NEEDS_DEFINES) || defined(__STDC_LIMIT_MACROS)
#ifndef _STDC_STDINT_H_LIMITMACROS
#define _STDC_STDINT_H_LIMITMACROS
#define INT8_MIN (-128)
@ -90,9 +94,9 @@
*/
#endif /* _STDC_STDINT_H_LIMITMACROS */
#endif /* !__cplusplus || __STDC_LIMIT_MACROS */
#endif /* !__STDC_NEEDS_DEFINES || __STDC_LIMIT_MACROS */
#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
#if !defined(__STDC_NEEDS_DEFINES) || defined(__STDC_CONSTANT_MACROS)
#ifndef _STDC_STDINT_H_CONSTMACROS
#define _STDC_STDINT_H_CONSTMACROS
@ -132,4 +136,4 @@
/* Maximal unsigned integer (unsigned long long) size */
# define UINTMAX_MAX UINT64_MAX
#endif /* _STDC_STDINT_H_CONSTMACROS */
#endif /* !__cplusplus || __STDC_CONSTANT_MACROS */
#endif /* !__STDC_NEEDS_DEFINES || __STDC_CONSTANT_MACROS */