public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17811] New: [4.0.0 Regression] Implicit extern "C" is broken resulting in C++ mangling function names in assert.h and ctype.h
@ 2004-10-03 16:25 danglin at gcc dot gnu dot org
  2004-10-03 16:31 ` [Bug c++/17811] " pinskia at gcc dot gnu dot org
  2004-10-03 16:43 ` dave at hiauly1 dot hia dot nrc dot ca
  0 siblings, 2 replies; 3+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-10-03 16:25 UTC (permalink / raw)
  To: gcc-bugs

These ports don't define NO_IMPLICIT_EXTERN_C.  The headers for assert.h
and ctype.h don't provide __cplusplus conditionalized extern "C".  From the
comments in assert.h, this is intentional.

The handling of implicit extern "C" in 4.0.0 doesn't work because the
processing of tokens is now deferred until after all the headers have
been read by the C frontend.  We have the following code in c-lex.c:

#ifndef NO_IMPLICIT_EXTERN_C
          if (c_header_level)
            ++c_header_level;
          else if (new_map->sysp == 2)
            {
              c_header_level = 1;
              ++pending_lang_change;
            }
#endif
        }
    }
  else if (new_map->reason == LC_LEAVE)
    {
#ifndef NO_IMPLICIT_EXTERN_C
      if (c_header_level && --c_header_level == 0)
        {
          if (new_map->sysp == 2)
            warning ("badly nested C headers from preprocessor");
          --pending_lang_change;
        }
#endif

pending_lang_change is incremented when a C system header is entered
and decremented when the header is left.  The corresponding code in
cp/parser.c is:

      /* The C lexer modifies PENDING_LANG_CHANGE when it wants the
         parser to enter or exit implicit `extern "C"' blocks.  */
      while (pending_lang_change > 0)
        {
          push_lang_context (lang_name_c);
          --pending_lang_change;
        }
      while (pending_lang_change < 0)
        {
          pop_lang_context ();
          ++pending_lang_change;
        }

      /* Parse the declaration itself.  */
      cp_parser_declaration (parser);

This only works if the declarations are parsed immediately after c-lex.c
has incremented/decremented pending_lang_change.  However, the parser now
defers parsing of declarations until after all the header files have been
processed and the tokens stashed in a varray.

-- 
           Summary: [4.0.0 Regression] Implicit extern "C" is broken
                    resulting in C++ mangling function names in assert.h and
                    ctype.h
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: danglin at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix4.x, powerpc-ibm-aix5.x
  GCC host triplet: powerpc-ibm-aix4.x, powerpc-ibm-aix5.x
GCC target triplet: powerpc-ibm-aix4.x, powerpc-ibm-aix5.x


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17811


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/17811] [4.0.0 Regression] Implicit extern "C" is broken resulting in C++ mangling function names in assert.h and ctype.h
  2004-10-03 16:25 [Bug c++/17811] New: [4.0.0 Regression] Implicit extern "C" is broken resulting in C++ mangling function names in assert.h and ctype.h danglin at gcc dot gnu dot org
@ 2004-10-03 16:31 ` pinskia at gcc dot gnu dot org
  2004-10-03 16:43 ` dave at hiauly1 dot hia dot nrc dot ca
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 16:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-03 16:31 -------
Fixed by: <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02790.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |rejects-valid
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17811


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/17811] [4.0.0 Regression] Implicit extern "C" is broken resulting in C++ mangling function names in assert.h and ctype.h
  2004-10-03 16:25 [Bug c++/17811] New: [4.0.0 Regression] Implicit extern "C" is broken resulting in C++ mangling function names in assert.h and ctype.h danglin at gcc dot gnu dot org
  2004-10-03 16:31 ` [Bug c++/17811] " pinskia at gcc dot gnu dot org
@ 2004-10-03 16:43 ` dave at hiauly1 dot hia dot nrc dot ca
  1 sibling, 0 replies; 3+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-10-03 16:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-10-03 16:43 -------
Subject: Re:  [4.0.0 Regression] Implicit extern "C" is broken

> Fixed by: <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02790.html>.

Thanks.

I'm close to getting C++ to work again on AIX 4.x and 5.x without weak
support.

Dave


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17811


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-03 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-03 16:25 [Bug c++/17811] New: [4.0.0 Regression] Implicit extern "C" is broken resulting in C++ mangling function names in assert.h and ctype.h danglin at gcc dot gnu dot org
2004-10-03 16:31 ` [Bug c++/17811] " pinskia at gcc dot gnu dot org
2004-10-03 16:43 ` dave at hiauly1 dot hia dot nrc dot ca

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