mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
@@ -31,7 +31,9 @@ option(TRACE_PARSER "Trace parser execution" OFF)
|
||||
option(TRACE_LEXER "Trace lexer execution" OFF)
|
||||
|
||||
if(MSVC)
|
||||
add_compile_options(/W1 /MP)
|
||||
# MSVC's standard library triggers warning C5105,
|
||||
# "macro expansion producing 'defined' has undefined behavior"
|
||||
add_compile_options(/std:c11 /W1 /MP /wd5105)
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
add_compile_options(-Wall -pedantic)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "asm/section.h"
|
||||
|
||||
#include "platform.h" // MIN_NB_ELMS
|
||||
#include "types.h"
|
||||
|
||||
#define HASHSIZE (1 << 16)
|
||||
@@ -117,7 +118,7 @@ void sym_SetExportAll(bool set);
|
||||
struct Symbol *sym_AddLocalLabel(char const *symName);
|
||||
struct Symbol *sym_AddLabel(char const *symName);
|
||||
struct Symbol *sym_AddAnonLabel(void);
|
||||
void sym_WriteAnonLabelName(char name[static MAXSYMLEN + 1], uint32_t ofs, bool neg);
|
||||
void sym_WriteAnonLabelName(char buf[MIN_NB_ELMS(MAXSYMLEN + 1)], uint32_t ofs, bool neg);
|
||||
void sym_Export(char const *symName);
|
||||
struct Symbol *sym_AddEqu(char const *symName, int32_t value);
|
||||
struct Symbol *sym_AddSet(char const *symName, int32_t value);
|
||||
|
||||
@@ -39,4 +39,11 @@
|
||||
# define SSIZE_MAX INT_MAX
|
||||
#endif
|
||||
|
||||
/* MSVC doesn't support `[static N]` for array arguments from C99 */
|
||||
#ifdef _MSC_VER
|
||||
# define MIN_NB_ELMS(N)
|
||||
#else
|
||||
# define MIN_NB_ELMS(N) static (N)
|
||||
#endif
|
||||
|
||||
#endif /* RGBDS_PLATFORM_H */
|
||||
|
||||
@@ -13,7 +13,7 @@ set(common_src
|
||||
)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(NOT PKG_CONFIG_FOUND)
|
||||
if(MSVC OR NOT PKG_CONFIG_FOUND)
|
||||
# fallback to find_package
|
||||
find_package(PNG REQUIRED)
|
||||
else()
|
||||
|
||||
@@ -47,9 +47,12 @@
|
||||
|
||||
/* Neither MSVC nor MinGW provide `mmap` */
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# include <windows.h>
|
||||
# include <fileapi.h>
|
||||
# include <winbase.h>
|
||||
# define WIN32_LEAN_AND_MEAN // include less from windows.h
|
||||
# include <windows.h> // target architecture
|
||||
# include <fileapi.h> // CreateFileA
|
||||
# include <winbase.h> // CreateFileMappingA
|
||||
# include <memoryapi.h> // MapViewOfFile
|
||||
# include <handleapi.h> // CloseHandle
|
||||
# define MAP_FAILED NULL
|
||||
# define mapFile(ptr, fd, path, size) do { \
|
||||
(ptr) = MAP_FAILED; \
|
||||
|
||||
@@ -567,7 +567,7 @@ struct Symbol *sym_AddAnonLabel(void)
|
||||
/*
|
||||
* Write an anonymous label's name to a buffer
|
||||
*/
|
||||
void sym_WriteAnonLabelName(char buf[static MAXSYMLEN + 1], uint32_t ofs, bool neg)
|
||||
void sym_WriteAnonLabelName(char buf[MIN_NB_ELMS(MAXSYMLEN + 1)], uint32_t ofs, bool neg)
|
||||
{
|
||||
uint32_t id = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user