This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix int vs enum issues with in stabs support


Bootstrap on powerpc-aix currently stops in stage2 on:

    << [...]
    cc1: warnings being treated as errors
    ../src/gcc/dbxout.c: In function 'dbxout_symbol':
    .../dbxout.c:2685: error: enum conversion when passing argument 2 of
     'dbxout_finish_complex_stabs' is invalid in C++
    .../dbxout.c:845: note: expected 'enum __stab_debug_code' but argument is
     of type 'int'
    ...
    .../dbxout.c:3368: error: enum conversion in assignment is invalid in C++
    ...
    >>

Despite 

  #define STAB_CODE_TYPE enum __stab_debug_code

in a couple of places, stab codes really are processed as integers
with convenient names. For instance, xcoffout.c:

  << /* Conversion routine from BSD stabs to AIX storage classes.  */
     int
     stab_to_sclass (int stab)
     [...]
  >>

or xcoffout.h:

  << /* These are IBM XCOFF extensions we need to reference in dbxout.c
        and xcoffout.c.  */

     /* AIX XCOFF uses this for typedefs.  This can have any value, since it is
	only used for translation into a C_DECL storage class.  */
     #ifndef N_DECL
     #define N_DECL 0x8c
     #endif
  >>

The attached patch is a suggestion to address the build failure by
introducing a stab_code_t typedef to int, to replace STAB_CODE_TYPE
where used so that all the pieces agree on a consistent view.

Tested on powerpc-ibm-aix5.3.0.0 by first verifying that the bootstrap
proceeds past the failure point after the change. I also checked that
basic debugging capabilities were still OK. They were except for a
problem with local variables (registered stack locations off the real
ones), which I think is unrelated.

Thanks in advance,

Olivier

2009-05-05  Olivier Hainque  <hainque@adacore.com>

	* gstab.h (stab_code_t): Define, to be used instead of the
	__stab_debug_code enum, made anonymous.
	* dbxout.c (STAB_CODE_TYPE): Remove #define and replace use
	occurrences by stab_code_t.
	* mips-tfile.c (STAB_CODE_TYPE): Remove #define, unused.

Attachment: stabcodes.dif
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]