Article View: gnu.gcc.help
Article #50633gcc2.4.5 and function's typedefs
From: Lionel Mallet
Date: Fri, 27 Aug 1993 14:57
Date: Fri, 27 Aug 1993 14:57
52 lines
2291 bytes
2291 bytes
Assume the following C file (foo.c):
#include <X11/Intrinsic.h>
XtCallbackProc foo(Widget w, XtPointer client_data, XtPointer call_data)
{
/* nothing inside */
}
When compiling this code with gcc -Wall I get the following message:
mallet@skye% gcc -c -v -Wall foo.c
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.1/2.4.5/specs
gcc version 2.4.5
/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.1/2.4.5/cpp -lang-c -v -undef
-D__GNU
C__=2 -Dsparc -Dsun -Dunix -D__GCC_NEW_VARARGS__ -D__sparc__ -D__sun__
-D__unix_
_ -D__GCC_NEW_VARARGS__ -D__sparc -D__sun -D__unix -D__GCC_NEW_VARARGS__ -Wall
f
oo.c /usr/tmp/cca12774.i
GNU CPP version 2.4.5 (sparc)
/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.1/2.4.5/cc1 /usr/tmp/cca12774.i
-quie
t -dumpbase foo.c -Wall -version -o /usr/tmp/cca12774.s
GNU C version 2.4.5 (sparc) compiled by GNU C version 2.4.5.
foo.c: In function `foo':
foo.c:6: warning: control reaches end of non-void function
as -o foo.o /usr/tmp/cca12774.s
mallet@skye%
I assume that strange warning is telling me that I should have add a return
statement cause my function is not declared as returning void.
But in fact my function *IS* declared as returning void as the XtCallbackProc
type is a typedef of this kind:
typedef void (*XtCallbackProc)(
#if NeedFunctionPrototypes
Widget /* widget */,
XtPointer /* closure */, /* data the application registered */
XtPointer /* call_data */ /* callback specific data */
#endif
);
Is it that gcc cannot properly handle function's typedefs or am I doing
something
wrong?
Any help would be greatly appreciated.
--
Lionel Mallet - mallet@simpolis.fr - Simulog - FRANCE
Technical Details
Message-ID:
<55192@sophia.inria.fr>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!mcsun!julienas!sophia!gaia.inria.fr!malletShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,d8aff1ea61eb00c8,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-08-27 08:19:02 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!mcsun!julienas!sophia!gaia.inria.fr!mallet From: mallet@gaia.inria.fr (Lionel Mallet) Newsgroups: gnu.gcc.help Subject: gcc2.4.5 and function's typedefs Message-ID: <55192@sophia.inria.fr> Date: 27 Aug 93 14:57:03 GMT Sender: news@sophia.inria.fr Organization: Simulog, France Lines: 52