public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ingo Krabbe <ikrabbe.ask@web.de>
To: gcc-help@gcc.gnu.org
Subject: Re: trying to understand: "warning: function declaration isn't a   prototype"
Date: Thu, 06 Jul 2006 11:32:00 -0000	[thread overview]
Message-ID: <200607061332.07159.ikrabbe.ask@web.de> (raw)
In-Reply-To: <a06230918c0d28515b036@[192.168.1.100]>

[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]

Am Donnerstag, 6. Juli 2006 11:21 schrieb Jay Vaughan:
> >Well, I explained why the warning is being emitted.
>
> Yes, because I haven't suppressed it with a switch .. but what I want
> to know is what the warning means.
>
> >Perhaps you could rephrase your question.  Or perhaps you could
> >provide the exact error message and the line in the source code to
> >which it refers.
>
> ../../common/Headers/msExtern.h:60: warning: function declaration
> isn't a prototype
>
> ------------------------------------
> msTypes.h (#included by msDefs.h):
> #define FAR
> #define FarPtr(type)  type FAR *
>
>
> ------------------------------------
> msDefs.h (#included by msExtern.h)
>
> typedef FarPtr(void)                TApplContextPtr;
>
>
> ------------------------------------
> msExtern.h:60:
>
> TApplContextPtr CreateApplContext ();
>
>
> ------------------------------------
> msLinux.c:
>
> TApplContextPtr CreateApplContext()
> {
>      LinuxContextPtr ptr =
>          (LinuxContextPtr) kmalloc(sizeof(LinuxContext), GFP_KERNEL);
>    //.. etc ..
>      return ptr;
> }
>
>
>
> The way I interpret this warning, its telling me that "FarPtr(void)
> CreatApplContext();" resolves to " * CreateApplContext();" .. clearly
> not a friendly prototype .. but which I suppose should probably be
> something more like (void) *CreateApplContext(); .. meaning I should
> fix the "#define FAR" to be "#define FAR void" instead ..

You might look at the results of the prototyping you can choose gcc -E 
some_file.c and see the result:

I attached xy.c.  The result of 

gcc -E xy.c | grep "typedef.*AbcPtr"             is
typedef void * AbcPtr;

which seems to be ok.

You should lookup if the definitions above are somehow hidden by conditionals, 
which you also can control via gcc -E.

[-- Attachment #2: xy.c --]
[-- Type: text/x-csrc, Size: 240 bytes --]

#include <stdio.h>

#define FAR
#define FarType(x) x FAR *
typedef FarType(void) AbcPtr;

extern AbcPtr func();

AbcPtr func()
{
	printf( "hello far ptr\n" );
	return (AbcPtr)NULL;
}

int main(int argc, char** argv)
{
	func();
	return 0;
}

  reply	other threads:[~2006-07-06 11:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-05 14:43 Jay Vaughan
2006-07-05 16:39 ` Ian Lance Taylor
2006-07-05 17:23   ` Jay Vaughan
2006-07-05 17:27     ` Ian Lance Taylor
2006-07-06  9:21       ` Jay Vaughan
2006-07-06 11:32         ` Ingo Krabbe [this message]
2006-07-06 11:44           ` Ingo Krabbe
2006-07-06 13:30         ` Ian Lance Taylor
2006-07-06 13:28 John Yates
2006-07-06 13:31 ` Jay Vaughan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200607061332.07159.ikrabbe.ask@web.de \
    --to=ikrabbe.ask@web.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).