avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How to warn if a function called with extra arguments


From: Ian Caddy
Subject: Re: [avr-gcc-list] How to warn if a function called with extra arguments
Date: Mon, 22 Mar 2004 15:42:54 +0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113

<x-flowed>
Hi Tom,

Didn't you answer your own question here.

If you want warnings about function prototypes, then you must define prototypes.

In your case, you should have a prototype for f such as:

void f(void);

Hope this helps,

Ian Caddy


Tom Harris wrote:

Greetings,

Here is an example of code that compiles with no warnings:

void f() {
}

void g() {
        f(1); // extra argument
}

I know that it is harmless, but s there a way to persuade gcc to print a
warning in such cases?

If I declare f as `f(void)` then the compiler complains about the extra
argument.
Compiler options are `-c -g -Os -mcall-prologues  -fshort-enums
-fpack-struct  -Wall -W -Wno-main -mmcu=atmega32 -std=gnu99"

Thanks

TomH

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list

</x-flowed>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]