You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/09/18 18:16:22 UTC

[jira] Created: (STDCXX-291) [HP aCC 6.05/HP-UX 11.23] struct siagaction declared extern "C++"

[HP aCC 6.05/HP-UX 11.23] struct siagaction declared extern "C++"
-----------------------------------------------------------------

                 Key: STDCXX-291
                 URL: http://issues.apache.org/jira/browse/STDCXX-291
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: HP aCC 6.05/HP-UX 11.23
            Reporter: Martin Sebor


The program below fails to compile with HP aCC 6.05 on HP-UX 11.23 (IPF):

$ cat t.cpp && aCC -AA -V +strict -c t.cpp
#include <signal.h>

extern "C" int foo (int signo, void (*func)(int))
{
    struct sigaction act;
    act.sa_handler = func;
    return 0 > sigaction (signo, &act, 0);
}

aCC: HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005]
"t.cpp", line 6: error #2513: a value of type "void (*)(int) C" cannot be
          assigned to an entity of type "void (*)(int)"
      act.sa_handler = func;
                     ^

1 error detected in the compilation of "t.cpp".


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (STDCXX-291) [HP aCC 6.05/HP-UX 11.23] struct siagaction declared extern "C++"

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/STDCXX-291?page=comments#action_12435514 ] 
            
Martin Sebor commented on STDCXX-291:
-------------------------------------

-------- Original Message --------
Subject: Re:  struct siagaction declared extern "C++"
Date: Sat, 16 Sep 2006 00:14:02 -0700 (PDT)
From: Dennis Handly <dh...@cup.hp.com>
To: acxx@cup.hp.com, sebor@roguewave.com

>From: Martin Sebor <se...@roguewave.com>
>I'm getting an error for the code below -- it looks like struct
>sigaction isn't declared extern "C" as it should be.

Previous compilers (going back to cfront) only cared about functions and
it looks like the libc team limited the extern "C" blocks to just them
and not types.

I filed CR JAGag17067:
Error 2513 on struct sigaction with +strict on <sys/signal.h>

I found I had to do a lot of clean up because of 2513 with +strict on
pointers to functions in some of our library code.
I.e. adding typedefs for cast, and defining them in extern "C" blocks.

I assume you could just use:
#ifdef WORK
   *(void (**)(int))&
#endif
   act.sa_handler = func;


> [HP aCC 6.05/HP-UX 11.23] struct siagaction declared extern "C++"
> -----------------------------------------------------------------
>
>                 Key: STDCXX-291
>                 URL: http://issues.apache.org/jira/browse/STDCXX-291
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: HP aCC 6.05/HP-UX 11.23
>            Reporter: Martin Sebor
>
> The program below fails to compile with HP aCC 6.05 on HP-UX 11.23 (IPF):
> $ cat t.cpp && aCC -AA -V +strict -c t.cpp
> #include <signal.h>
> extern "C" int foo (int signo, void (*func)(int))
> {
>     struct sigaction act;
>     act.sa_handler = func;
>     return 0 > sigaction (signo, &act, 0);
> }
> aCC: HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005]
> "t.cpp", line 6: error #2513: a value of type "void (*)(int) C" cannot be
>           assigned to an entity of type "void (*)(int)"
>       act.sa_handler = func;
>                      ^
> 1 error detected in the compilation of "t.cpp".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira