public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18292] New: Cannot use function name within function.
@ 2004-11-03 20:51 deepak at despammed dot com
2004-11-03 21:06 ` [Bug c/18292] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: deepak at despammed dot com @ 2004-11-03 20:51 UTC (permalink / raw)
To: gcc-bugs
Under the said version of gcc, I cannot say something like:
void foo(int bar)
{
extern void foo(int);
/* do_something. */
/* Reinstate handler. */
signal(SIGINT, foo);
}
Output is something like:
foo.c:750: error: called object is not a function
foo.c:751: error: called object is not a function
make[1]: *** [foo.o] Error 1
--
Summary: Cannot use function name within function.
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: deepak at despammed dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: Mandrake Linux 10.0 3.3.2-6mdk
GCC host triplet: i586-mandrake-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18292
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18292] Cannot use function name within function.
2004-11-03 20:51 [Bug c/18292] New: Cannot use function name within function deepak at despammed dot com
@ 2004-11-03 21:06 ` pinskia at gcc dot gnu dot org
2004-11-03 21:38 ` deepak at despammed dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-03 21:06 -------
I cannot reproduce this, can you attach the preprocessed source?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18292
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18292] Cannot use function name within function.
2004-11-03 20:51 [Bug c/18292] New: Cannot use function name within function deepak at despammed dot com
2004-11-03 21:06 ` [Bug c/18292] " pinskia at gcc dot gnu dot org
@ 2004-11-03 21:38 ` deepak at despammed dot com
2004-11-03 21:41 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: deepak at despammed dot com @ 2004-11-03 21:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From deepak at despammed dot com 2004-11-03 21:38 -------
(In reply to comment #1)
> I cannot reproduce this, can you attach the preprocessed source?
Here is the plain source:
#include <signal.h>
extern volatile sig_atomic_t pe_connection_BAD;
void
sig(int signal) {
int omask = sigsetmask(0); /* sigsetmask(foo): we just need omask. */
extern void sig(int);
switch (signal) {
case SIGINT :
break;
case SIGUSR1 :
pe_connection_BAD = 1;
}
sigblock(omask & ~sigmask(SIGINT));
signal(SIGINT, sig); /* nscli will check for it. */
signal(SIGUSR1, sig);
}
$ cc ~/test.c -c
/home/deep/test.c: In function `sig':
/home/deep/test.c:18: error: called object is not a function
/home/deep/test.c:19: error: called object is not a function
$
I have added the preprocessed code to this bug report as attachment.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18292
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18292] Cannot use function name within function.
2004-11-03 20:51 [Bug c/18292] New: Cannot use function name within function deepak at despammed dot com
2004-11-03 21:06 ` [Bug c/18292] " pinskia at gcc dot gnu dot org
2004-11-03 21:38 ` deepak at despammed dot com
@ 2004-11-03 21:41 ` pinskia at gcc dot gnu dot org
2004-11-03 21:50 ` deepak at despammed dot com
2004-11-03 21:57 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 21:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-03 21:41 -------
Not a bug, you have a variable called signal which shadows the global function:
sig(int signal) {
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18292
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18292] Cannot use function name within function.
2004-11-03 20:51 [Bug c/18292] New: Cannot use function name within function deepak at despammed dot com
` (2 preceding siblings ...)
2004-11-03 21:41 ` pinskia at gcc dot gnu dot org
@ 2004-11-03 21:50 ` deepak at despammed dot com
2004-11-03 21:57 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: deepak at despammed dot com @ 2004-11-03 21:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From deepak at despammed dot com 2004-11-03 21:50 -------
(In reply to comment #4)
> Not a bug, you have a variable called signal which shadows the global function:
> sig(int signal) {
Agree. Is it possible to change the error message to say exactly this? For
instance, declaring a local variable under the same name as a parameter gives
this --
/home/deep/test2.c:3: warning: declaration of `bar' shadows a parameter
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18292
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18292] Cannot use function name within function.
2004-11-03 20:51 [Bug c/18292] New: Cannot use function name within function deepak at despammed dot com
` (3 preceding siblings ...)
2004-11-03 21:50 ` deepak at despammed dot com
@ 2004-11-03 21:57 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 21:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-03 21:57 -------
Use -Wshadow:
-Wshadow Warn when one local variable shadows another
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18292
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-11-03 21:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-03 20:51 [Bug c/18292] New: Cannot use function name within function deepak at despammed dot com
2004-11-03 21:06 ` [Bug c/18292] " pinskia at gcc dot gnu dot org
2004-11-03 21:38 ` deepak at despammed dot com
2004-11-03 21:41 ` pinskia at gcc dot gnu dot org
2004-11-03 21:50 ` deepak at despammed dot com
2004-11-03 21:57 ` pinskia at gcc dot gnu dot org
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).