Mail Archives: djgpp-workers/2012/12/28/16:15:43
The patch below will fix the warning:
ISO C forbids conversion of function pointer to object pointer type [-pedantic]
in /tests/dxe and elsewhere. I am aware that casting the function pointer to
a dat pointer is not the portable way to solve this issue but for djgpp this
approach may be good enough. AFAIK for djgpp/dpmi the pointers to data objects
and to functions have both 32bit size so this approach should not hurt.
If someone has a better solution avoiding the cast to intptr_t
it will be welcome. Please note that the proposed solution must work with C and C++.
Regards,
Juan M. Guerrero
diff -aprNU5 djgpp.orig/include/sys/dxe.h djgpp/include/sys/dxe.h
--- djgpp.orig/include/sys/dxe.h 2011-07-30 13:05:48 +0000
+++ djgpp/include/sys/dxe.h 2012-12-28 21:03:34 +0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2012 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2003 Borca Daniel <dborca AT yahoo DOT com>
Copyright (C) 2000 Andrew Zabolotny <bit AT eltech DOT ru>
Copyright (C) 1995 Charles Sandmann (sandmann AT clio DOT rice DOT edu)
@@ -7,10 +8,12 @@
symbols are in dlfcn.h. Contributed to the DJGPP project. */
#ifndef __dj_include_dxe_h_
#define __dj_include_dxe_h_
+#include <stdint.h> /* for intptr_t */
+
/* the following are needed when cross compiling hostbin exes */
#ifndef _DJ_DEFINED_NATIVE_TYPES
#define _DJ_DEFINED_NATIVE_TYPES
#ifdef _LP64 /* Note: win64 is LLP64 */
# define LONG32 int
@@ -210,11 +213,11 @@ void dlstatunbind (const char *module, v
{ \
extern void *__alias__##name __asm("_" #name); \
dlregsym ((void *)&__alias__##name); \
} \
static __attribute_used dxe_symbol_table name [] = {
-#define DXE_EXPORT(symbol) { "_" #symbol, (void *)&symbol },
+#define DXE_EXPORT(symbol) { "_" #symbol, (void *)(intptr_t)&symbol },
#define DXE_EXPORT_END { 0, 0 }};
/*
* Alternatively, one can build the export table this way:
*
- Raw text -