Improve minizconf.h; in CMake, don't use C++-compilerflags for plain C

This commit is contained in:
Daniel Gibson 2024-06-04 09:30:54 +02:00
parent 1b344d4b78
commit c317e604c6
2 changed files with 17 additions and 9 deletions

View file

@ -362,20 +362,20 @@ if(D3_COMPILER_IS_GCC_OR_CLANG)
CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual)
if(cxx_has_Woverload_virtual)
add_compile_options(-Woverloaded-virtual)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
endif()
# shut up about using memcpy() on classes, in the cases doom3 uses it it seems to be fine
CHECK_CXX_COMPILER_FLAG("-Wno-class-memaccess" cxx_has_Wno-class-memaccess)
if(cxx_has_Wno-class-memaccess)
add_compile_options(-Wno-class-memaccess)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess")
endif()
# ignore warnings about variables named "requires" for now (in C++20 it's a keyword,
# but currently we don't even use C++11 features)
CHECK_CXX_COMPILER_FLAG("-Wno-c++20-compat" cxx_has_Wno-cpp20-compat)
if(cxx_has_Wno-cpp20-compat)
add_compile_options(-Wno-c++20-compat)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++20-compat")
endif()
if(AROS)

View file

@ -34,18 +34,22 @@
#ifndef COMMON_UNZIP_MINIZCONF_H
#define COMMON_UNZIP_MINIZCONF_H
#ifndef OF
#define OF(args) args
#ifndef z_off_t
#if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#define z_off_t off_t
#elif defined(off_t) // maybe we're lucky :-p
#define z_off_t off_t
#else
#define z_off_t long
#endif
#endif
#ifndef ZEXPORT
#define ZEXPORT
#endif
#ifndef z_off_t
#define z_off_t long
#endif
// FIXME: why not just set this to int64_t?
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
@ -56,4 +60,8 @@
# endif
#endif
#if defined(__cplusplus) && __cplusplus >= 201103L
static_assert( sizeof(z_off64_t) == 8, "z_off64_t should be a 64bit type" );
#endif
#endif