delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2012/12/28/16:15:43

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX1/bOXIZE+HbOcygdUO0xnGewFQpjiBJQLdGFTVtu7
OW9B7D6D2OtF9/
Message-ID: <50DE08ED.3000409@gmx.de>
Date: Fri, 28 Dec 2012 22:02:37 +0100
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Fixing test-cases (patch 3/3)
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019