Opened 3 years ago

Last modified 3 years ago

#352 new defect

GCC 4 barfs on _PFN definition in os2emx.h

Reported by: dmik Owned by:
Priority: normal Milestone: new
Component: emx Version: 0.6.6
Severity: normal Keywords:
Cc:

Description

If you pass the -Wstrict-prototypes option to GCC 4, an attempt to compile a C source that includes <os2.h> will give you this:

/@unixroot/usr/include/os2emx.h:323:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]

One example is fontconfig: http://trac.netlabs.org/ports/browser/fontconfig/trunk.

Change History (1)

comment:1 Changed 3 years ago by dmik

The definition of _PFN is as follows:

#ifdef OS2EMX_UNSTRICT
typedef int _PFN();
#else
typedef int APIENTRY _PFN();
#endif

From what I get, the warnings is because a function that doesn't take any arguments is not a valid prototype in C. The warning goes away if we put VOID inside braces but that may cause warnings when assigning function addresses to PFN variables. So we can simply shut up this particular warning for this part of the header:

#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#ifdef OS2EMX_UNSTRICT
typedef int _PFN();
#else
typedef int APIENTRY _PFN();
#endif
#pragma GCC diagnostic ignored pop
Note: See TracTickets for help on using tickets.