This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: Question concerning comment in symtab.h


Paul N. Hilfinger writes:
 > 
 > The definition of struct block contains:
 > 
 >     /* Version of GCC used to compile the function corresponding
 >        to this block, or 0 if not compiled with GCC.  When possible,
 >        GCC should be compatible with the native compiler, or if that
 >        is not feasible, the differences should be fixed during symbol
 >        reading.  As of 16 Apr 93, this flag is never used to distinguish
 >        between gcc2 and the native compiler.
 > 
 >        If there is no function corresponding to this block, this meaning
 >        of this flag is undefined.  */
 > 
 >     unsigned char gcc_compile_flag;
 > 
 > Am I correct that this comment is wrong?  For example, in valops.c 
 > (hand_function_call), we find 
 > 
 >   {
 >     struct block *b = block_for_pc (funaddr);
 >     /* If compiled without -g, assume GCC 2.  */
 >     using_gcc = (b == NULL ? 2 : BLOCK_GCC_COMPILED (b));
 >   }
 > 
 >   ... and later ...
 > 
 >       if (using_gcc == 0)
 > 	if (param_type)
 > 	  /* if this parameter is a pointer to function */
 > 	  if (TYPE_CODE (param_type) == TYPE_CODE_PTR)
 > 	    if (TYPE_CODE (param_type->target_type) == TYPE_CODE_FUNC)
 > 	      /* elz: FIXME here should go the test about the compiler used
 > 	         to compile the target. We want to issue the error
 > 	         message only if the compiler used was HP's aCC.
 > 
 > which looks to me as if it handles GCC 2 and native compilers differently.
 > 

This code in valops.c was added to handle HP's native compiler. I am
really tempted to just remove it, because it breaks function calls
with function pointers as parameters for all the cases in which gcc is
not used. I am going to submit a patch to get rid of this code.

If I do that, I think the only remaining use of gcc_compile_flag
outside of the symbol readers is in generic_use_struct_convention in
values.c, and it is used to distinguish between different versions of
gcc (specifically 2.0 to 2.3.3, vs. all the others). I wonder if this
could be eliminated as well.


 > [I ask because we may have another use for BLOCK_GCC_COMPILED, which simply
 > returns gcc_compile_flag, and I want to understand whether anything DEPENDS
 > on the assertion in this comment.]
 > 
 > Paul Hilfinger
 > 

Elena


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