[Bug c/18292] New: Cannot use function name within function.

2004-11-03 Thread deepak at despammed dot com
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


[Bug c/18292] Cannot use function name within function.

2004-11-03 Thread deepak at despammed dot com

--- 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 

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


[Bug c/18292] Cannot use function name within function.

2004-11-03 Thread deepak at despammed dot com

--- 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