mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
Workaround Uplink compilation for MINGW 32bit
The uplink code breaks compilation with strict warnings for MINGW (only for 32-bit). error: ISO C forbids conversion of object pointer to function pointer type [-Werror=pedantic] or error: ISO C forbids assignment between function pointer and 'void *' [-Werror=pedantic] and some other missing declarations and prototypes. As uplink.h is included in cryptlib.h and used in BIO code, using a pragma to disable warnings would touch to much code. With (uintptr_t) cast, it silences cast warnings with gcc. For the rest of the code, just disable warnings, as this code would need to be rewritten and heavily retested on older systems. NOTE: applink.c is INCLUDED from uplink.h. Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Norbert Pocs <norbertp@openssl.org> MergeDate: Tue Apr 28 16:02:22 2026 (Merged from https://github.com/openssl/openssl/pull/30963)
This commit is contained in:
@@ -35,6 +35,12 @@
|
||||
|
||||
#ifndef APPMACROS_ONLY
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Normally, do not define APPLINK_NO_INCLUDES. Define it if you are using
|
||||
* symbol preprocessing and do not want the preprocessing to affect the
|
||||
@@ -145,6 +151,10 @@ __declspec(dllexport) void **
|
||||
return OPENSSL_ApplinkTable;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+7
-1
@@ -17,12 +17,19 @@
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include "uplink.h"
|
||||
void OPENSSL_showfatal(const char *, ...);
|
||||
void OPENSSL_Uplink(volatile void **table, int index);
|
||||
|
||||
static TCHAR msg[128];
|
||||
|
||||
@@ -73,7 +80,6 @@ void OPENSSL_Uplink(volatile void **table, int index)
|
||||
|
||||
if (applinktable == NULL) {
|
||||
void **(*applink)();
|
||||
|
||||
applink = (void **(*)())GetProcAddress(h, "OPENSSL_Applink");
|
||||
if (applink == NULL) {
|
||||
apphandle = (HMODULE)-1;
|
||||
|
||||
+22
-22
@@ -12,27 +12,27 @@
|
||||
|
||||
extern void *OPENSSL_UplinkTable[];
|
||||
|
||||
#define UP_stdin (*(void *(*)(void))OPENSSL_UplinkTable[APPLINK_STDIN])()
|
||||
#define UP_stdout (*(void *(*)(void))OPENSSL_UplinkTable[APPLINK_STDOUT])()
|
||||
#define UP_stderr (*(void *(*)(void))OPENSSL_UplinkTable[APPLINK_STDERR])()
|
||||
#define UP_fprintf (*(int (*)(void *, const char *, ...))OPENSSL_UplinkTable[APPLINK_FPRINTF])
|
||||
#define UP_fgets (*(char *(*)(char *, int, void *))OPENSSL_UplinkTable[APPLINK_FGETS])
|
||||
#define UP_fread (*(size_t (*)(void *, size_t, size_t, void *))OPENSSL_UplinkTable[APPLINK_FREAD])
|
||||
#define UP_fwrite (*(size_t (*)(const void *, size_t, size_t, void *))OPENSSL_UplinkTable[APPLINK_FWRITE])
|
||||
#define UP_fsetmod (*(int (*)(void *, char))OPENSSL_UplinkTable[APPLINK_FSETMOD])
|
||||
#define UP_feof (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FEOF])
|
||||
#define UP_fclose (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FCLOSE])
|
||||
#define UP_stdin (*(void *(*)(void))(uintptr_t)OPENSSL_UplinkTable[APPLINK_STDIN])()
|
||||
#define UP_stdout (*(void *(*)(void))(uintptr_t)OPENSSL_UplinkTable[APPLINK_STDOUT])()
|
||||
#define UP_stderr (*(void *(*)(void))(uintptr_t)OPENSSL_UplinkTable[APPLINK_STDERR])()
|
||||
#define UP_fprintf (*(int (*)(void *, const char *, ...))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FPRINTF])
|
||||
#define UP_fgets (*(char *(*)(char *, int, void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FGETS])
|
||||
#define UP_fread (*(size_t (*)(void *, size_t, size_t, void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FREAD])
|
||||
#define UP_fwrite (*(size_t (*)(const void *, size_t, size_t, void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FWRITE])
|
||||
#define UP_fsetmod (*(int (*)(void *, char))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FSETMOD])
|
||||
#define UP_feof (*(int (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FEOF])
|
||||
#define UP_fclose (*(int (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FCLOSE])
|
||||
|
||||
#define UP_fopen (*(void *(*)(const char *, const char *))OPENSSL_UplinkTable[APPLINK_FOPEN])
|
||||
#define UP_fseek (*(int (*)(void *, long, int))OPENSSL_UplinkTable[APPLINK_FSEEK])
|
||||
#define UP_ftell (*(long (*)(void *))OPENSSL_UplinkTable[APPLINK_FTELL])
|
||||
#define UP_fflush (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FFLUSH])
|
||||
#define UP_ferror (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FERROR])
|
||||
#define UP_clearerr (*(void (*)(void *))OPENSSL_UplinkTable[APPLINK_CLEARERR])
|
||||
#define UP_fileno (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FILENO])
|
||||
#define UP_fopen (*(void *(*)(const char *, const char *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FOPEN])
|
||||
#define UP_fseek (*(int (*)(void *, long, int))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FSEEK])
|
||||
#define UP_ftell (*(long (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FTELL])
|
||||
#define UP_fflush (*(int (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FFLUSH])
|
||||
#define UP_ferror (*(int (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FERROR])
|
||||
#define UP_clearerr (*(void (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_CLEARERR])
|
||||
#define UP_fileno (*(int (*)(void *))(uintptr_t)OPENSSL_UplinkTable[APPLINK_FILENO])
|
||||
|
||||
#define UP_open (*(int (*)(const char *, int, ...))OPENSSL_UplinkTable[APPLINK_OPEN])
|
||||
#define UP_read (*(ossl_ssize_t (*)(int, void *, size_t))OPENSSL_UplinkTable[APPLINK_READ])
|
||||
#define UP_write (*(ossl_ssize_t (*)(int, const void *, size_t))OPENSSL_UplinkTable[APPLINK_WRITE])
|
||||
#define UP_lseek (*(long (*)(int, long, int))OPENSSL_UplinkTable[APPLINK_LSEEK])
|
||||
#define UP_close (*(int (*)(int))OPENSSL_UplinkTable[APPLINK_CLOSE])
|
||||
#define UP_open (*(int (*)(const char *, int, ...))(uintptr_t)OPENSSL_UplinkTable[APPLINK_OPEN])
|
||||
#define UP_read (*(ossl_ssize_t (*)(int, void *, size_t))(uintptr_t)OPENSSL_UplinkTable[APPLINK_READ])
|
||||
#define UP_write (*(ossl_ssize_t (*)(int, const void *, size_t))(uintptr_t)OPENSSL_UplinkTable[APPLINK_WRITE])
|
||||
#define UP_lseek (*(long (*)(int, long, int))(uintptr_t)OPENSSL_UplinkTable[APPLINK_LSEEK])
|
||||
#define UP_close (*(int (*)(int))(uintptr_t)OPENSSL_UplinkTable[APPLINK_CLOSE])
|
||||
|
||||
Reference in New Issue
Block a user