update NORETURN macro for MSVC, cleanup

This commit is contained in:
Roman Fomin 2024-01-07 00:59:22 +07:00
parent c744db3a86
commit 2914d96495
3 changed files with 10 additions and 8 deletions

View File

@ -608,7 +608,7 @@ static boolean D_AddZipFile(const char *file)
char *str, *tempdir, counter[8];
static int idx = 0;
if (!M_StringCaseEndsWith(file, ".zip") && !M_StringEndsWith(file, ".pk3"))
if (!M_StringCaseEndsWith(file, ".zip") && !M_StringCaseEndsWith(file, ".pk3"))
{
return false;
}
@ -617,7 +617,6 @@ static boolean D_AddZipFile(const char *file)
if (!mz_zip_reader_init_file(&zip_archive, file, MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY))
{
I_Error("D_AddZipFile: Failed to open %s", file);
return false;
}
M_snprintf(counter, sizeof(counter), "%04d", idx);
@ -864,7 +863,6 @@ static void CheckIWAD(const char *iwadname)
{
fclose(file);
I_Error("CheckIWAD: failed to read header %s", iwadname);
return;
}
if (strncmp(header.identification, "IWAD", 4) &&
@ -872,7 +870,6 @@ static void CheckIWAD(const char *iwadname)
{
fclose(file);
I_Error("Wad file %s doesn't have IWAD or PWAD id\n", iwadname);
return;
}
// read IWAD directory
@ -886,7 +883,6 @@ static void CheckIWAD(const char *iwadname)
free(fileinfo);
fclose(file);
I_Error("CheckIWAD: failed to read directory %s", iwadname);
return;
}
for (i = 0; i < header.numlumps; ++i)

View File

@ -83,10 +83,16 @@ typedef uint8_t pixel_t;
#if defined(__GNUC__) || defined(__clang__)
#define PRINTF_ATTR(fmt, first) __attribute__((format(printf, fmt, first)))
#define PRINTF_ARG_ATTR(x) __attribute__((format_arg(x)))
#define NORETURN __attribute__((noreturn))
#else
#define PRINTF_ATTR(fmt, first)
#define PRINTF_ARG_ATTR(x)
#endif
#if defined(__GNUC__) || defined(__clang__)
#define NORETURN __attribute__((noreturn))
#elif defined (_MSC_VER)
#define NORETURN __declspec(noreturn)
#else
#define NORETURN
#endif

View File

@ -60,7 +60,7 @@ ticcmd_t* I_BaseTiccmd (void);
// killough 3/20/98: add const
// killough 4/25/98: add gcc attributes
void I_ErrorOrSuccess(int err_code, const char *error, ...) NORETURN PRINTF_ATTR(2, 3);
NORETURN void I_ErrorOrSuccess(int err_code, const char *error, ...) PRINTF_ATTR(2, 3);
#define I_Error(...) I_ErrorOrSuccess(-1, __VA_ARGS__)
#define I_Success(...) I_ErrorOrSuccess(0, __VA_ARGS__)
@ -81,7 +81,7 @@ typedef void (*atexit_func_t)(void);
void I_AtExitPrio(atexit_func_t func, boolean run_if_error,
const char* name, exit_priority_t priority);
#define I_AtExit(a,b) I_AtExitPrio(a,b,#a,exit_priority_normal)
void I_SafeExit(int rc) NORETURN;
NORETURN void I_SafeExit(int rc);
void I_ErrorMsg(void);
void *I_Realloc(void *ptr, size_t size);