da7f3bf1c1
This mode can be recognized by the macro __STRICT_ANSI__. From man gcc: -ansi In C mode, this is equivalent to -std=c89. In C++ mode, it is equivalent to -std=c++98. This turns off certain features of GCC that are incompatible with ISO C90 (when compiling C code), or of standard (when compiling code), such as the asm and typeof keywords, and predefined macros such as unix and vax that identify the type of system you are using. It also enables the undesirable and rarely used ISO trigraph feature. For the C compiler, it disables recognition of style // comments as well as the inline keyword. The alternate keywords _ _asm_ _, _ _extension_ _, _ _inline_ _ and _ _typeof_ _ continue to work despite -ansi. You would not want to use them in an ISO C program, of course, but it is useful to put them in header files that might be included in compilations done with -ansi. Alternate predefined macros such as _ _unix_ _ and _ _vax_ _ are also available, with or without -ansi. The -ansi option does not cause non-ISO programs to be rejected gratuitously. For that, -pedantic is required in addition to -ansi. The macro _ _STRICT_ANSI_ _ is predefined when the -ansi option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ISO standard doesn't call for; this is to avoid interfering with any programs that might use these names for other things. Functions that would normally be built in but do not have semantics defined by ISO C (such as alloca and ffs) are not built-in functions when -ansi is used.
125 lines
2.7 KiB
C
125 lines
2.7 KiB
C
|
|
|
|
#ifndef UPNPGLOBAL_H
|
|
#define UPNPGLOBAL_H
|
|
|
|
|
|
/*!
|
|
* \file
|
|
*
|
|
* \brief Defines constants that for some reason are not defined on some systems.
|
|
*/
|
|
|
|
|
|
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
|
#if defined __GNUC__
|
|
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
|
#else
|
|
#error libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef WIN32
|
|
/*
|
|
* EXPORT_SPEC
|
|
*/
|
|
#ifdef UPNP_STATIC_LIB
|
|
#define EXPORT_SPEC
|
|
#else /* UPNP_STATIC_LIB */
|
|
#ifdef LIBUPNP_EXPORTS
|
|
/*! set up declspec for dll export to make functions
|
|
* visible to library users */
|
|
#define EXPORT_SPEC __declspec(dllexport)
|
|
#else /* LIBUPNP_EXPORTS */
|
|
#define EXPORT_SPEC __declspec(dllimport)
|
|
#endif /* LIBUPNP_EXPORTS */
|
|
#endif /* UPNP_STATIC_LIB */
|
|
|
|
|
|
/*
|
|
* UPNP_INLINE
|
|
* PRId64
|
|
* PRIzu
|
|
*/
|
|
#ifdef UPNP_USE_MSVCPP
|
|
/* define some things the M$ VC++ doesn't know */
|
|
#define UPNP_INLINE
|
|
typedef __int64 int64_t;
|
|
#define PRId64 "I64d"
|
|
#define PRIzu "lu"
|
|
#endif /* UPNP_USE_MSVCPP */
|
|
|
|
|
|
#ifdef UPNP_USE_BCBPP
|
|
/* define some things Borland Builder doesn't know */
|
|
#define UPNP_INLINE inline
|
|
typedef __int64 int64_t;
|
|
#warning The Borland C compiler is probably broken on PRId64,
|
|
#warning please someone provide a proper fix here
|
|
#define PRId64 "I64d"
|
|
#define PRIzu "zu"
|
|
#endif /* UPNP_USE_BCBPP */
|
|
|
|
|
|
#ifdef __GNUC__
|
|
#define UPNP_INLINE inline
|
|
|
|
/* Note with PRIzu that in the case of Mingw32, it's the MS C
|
|
* runtime printf which ends up getting called, not the glibc
|
|
* printf, so it genuinely doesn't have "zu"
|
|
*/
|
|
#define PRIzu "lu"
|
|
#endif /* __GNUC__ */
|
|
#else
|
|
/*!
|
|
* \brief Export functions on WIN32 DLLs.
|
|
*
|
|
* Every funtion that belongs to the library API must use this
|
|
* definition upon declaration or it will not be exported on WIN32
|
|
* DLLs.
|
|
*/
|
|
#define EXPORT_SPEC
|
|
|
|
/*!
|
|
* \brief Declares an inline function.
|
|
*
|
|
* Surprisingly, there are some compilers that do not understand the
|
|
* inline keyword. This definition makes the use of this keyword
|
|
* portable to these systems.
|
|
*/
|
|
#ifdef __STRICT_ANSI__
|
|
#define UPNP_INLINE __inline__
|
|
#else
|
|
#define UPNP_INLINE inline
|
|
#endif
|
|
|
|
/*!
|
|
* \brief Supply the PRId64 printf() macro.
|
|
*
|
|
* MSVC still does not know about this.
|
|
*/
|
|
/* #define PRId64 PRId64 */
|
|
|
|
/*!
|
|
* \brief Supply the PRIzu printf() macro.
|
|
*
|
|
* This macro was invented so that we can live a little longer with
|
|
* MSVC lack of C99. "z" is the correct printf() size specifier for
|
|
* the size_t type.
|
|
*/
|
|
#define PRIzu "zu"
|
|
#endif
|
|
|
|
|
|
/*
|
|
* Defining this macro here gives some interesting information about unused
|
|
* functions in the code. Of course, this should never go uncommented on a
|
|
* release.
|
|
*/
|
|
/*#define inline*/
|
|
|
|
|
|
#endif /* UPNPGLOBAL_H */
|
|
|