Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Missing #include in objfiles.h?
@ 2002-08-01 12:28 Joel Brobecker
  2002-08-01 13:48 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2002-08-01 12:28 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

I'm not sure if this is intended or not, but objfiles.h relies on
symfile.h for the definition of certain structures. However, objfiles
does not #include symfile. So my attempt to include objfiles without
prior including symfile caused a compilation error. 

This patch adds the #include, assuming this was not intentional. Tested
by "./configure; make".

2002-08-01  Joel Brobecker  <brobecker@gnat.com>

        * objfiles.h: Add missing #include "symfile.h"
        
        * Makefile.in (objfiles_h): Add dependency on symfile.h and dependents.

Ok to apply?

Thanks,
-- 
Joel

[-- Attachment #2: objfiles.h.diff --]
[-- Type: text/plain, Size: 1405 bytes --]

Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.14
diff -c -3 -p -r1.14 objfiles.h
*** objfiles.h	29 Jul 2002 22:55:26 -0000	1.14
--- objfiles.h	1 Aug 2002 19:21:33 -0000
***************
*** 24,29 ****
--- 24,31 ----
  #define OBJFILES_H
  
  #include "gdb_obstack.h"		/* For obstack internals.  */
+ #include "symfile.h"
+ 
  struct bcache;
  
  /* This structure maintains information on a per-objfile basis about the
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.228
diff -c -3 -p -r1.228 Makefile.in
*** Makefile.in	30 Jul 2002 19:59:06 -0000	1.228
--- Makefile.in	1 Aug 2002 19:21:35 -0000
*************** macrotab_h =    macrotab.h
*** 656,662 ****
  macroscope_h =  macroscope.h $(macrotab_h) $(symtab_h)
  memattr_h =     memattr.h
  monitor_h =	monitor.h
! objfiles_h =	objfiles.h $(gdb_obstack_h)
  parser_defs_h =	parser-defs.h $(doublest_h)
  ppc_tdep_h =	ppc-tdep.h osabi.h
  regcache_h =	regcache.h
--- 656,662 ----
  macroscope_h =  macroscope.h $(macrotab_h) $(symtab_h)
  memattr_h =     memattr.h
  monitor_h =	monitor.h
! objfiles_h =	objfiles.h $(gdb_obstack_h) $(symfile_h)
  parser_defs_h =	parser-defs.h $(doublest_h)
  ppc_tdep_h =	ppc-tdep.h osabi.h
  regcache_h =	regcache.h

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

* Re: [RFA] Missing #include in objfiles.h?
  2002-08-01 12:28 [RFA] Missing #include in objfiles.h? Joel Brobecker
@ 2002-08-01 13:48 ` Andrew Cagney
  2002-08-02 20:10   ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-08-01 13:48 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> I'm not sure if this is intended or not, but objfiles.h relies on
> symfile.h for the definition of certain structures. However, objfiles
> does not #include symfile. So my attempt to include objfiles without
> prior including symfile caused a compilation error. 

What exactly?  A mindless grep suggests opaque references but not a hard 
dependency.  Adding an opaque ``struct sym_fns;'' to avoid an include is ok.

> This patch adds the #include, assuming this was not intentional. Tested
> by "./configure; make".
> 
> 2002-08-01  Joel Brobecker  <brobecker@gnat.com>
> 
>         * objfiles.h: Add missing #include "symfile.h"
>         
>         * Makefile.in (objfiles_h): Add dependency on symfile.h and dependents.
> 
> Ok to apply?

If there is a direct dependency then, yes, it should include it.

> + #include "symfile.h"

Suggest a comment mentioning what was needed.

enjoy,
Andrew

PS: I've this memory of, on true64 or hpux, there being a tangled mess 
of includes that stopped the above from being added.  That, however, is 
a true64/hppa problem and is likely fixed by multi-arching.



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

* Re: [RFA] Missing #include in objfiles.h?
  2002-08-01 13:48 ` Andrew Cagney
@ 2002-08-02 20:10   ` Joel Brobecker
  2002-08-03 16:25     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2002-08-02 20:10 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]

On Thu, Aug 01, 2002 at 04:48:05PM -0400, Andrew Cagney wrote:
> >I'm not sure if this is intended or not, but objfiles.h relies on
> >symfile.h for the definition of certain structures. However, objfiles
> >does not #include symfile. So my attempt to include objfiles without
> >prior including symfile caused a compilation error. 
> 
> What exactly?  A mindless grep suggests opaque references but not a hard 
> dependency.  Adding an opaque ``struct sym_fns;'' to avoid an include is ok.

Here are the fields in struct objfile that cause the compilation error:

    /* Vectors of all partial symbols read in from file.  The actual data
       is stored in the psymbol_obstack. */

    struct psymbol_allocation_list global_psymbols;
    struct psymbol_allocation_list static_psymbols;

So the full definition is need for this file to compile.

>2002-08-01  Joel Brobecker  <brobecker@gnat.com>
>
>        * objfiles.h: Add missing #include "symfile.h"
>        
>        * Makefile.in (objfiles_h): Add dependency on symfile.h and 
>        dependents.
>
> >+ #include "symfile.h"
> 
> Suggest a comment mentioning what was needed.

The attached patch contains the suggested comment.

> PS: I've this memory of, on true64 or hpux, there being a tangled mess 
> of includes that stopped the above from being added.  That, however, is 
> a true64/hppa problem and is likely fixed by multi-arching.

Just to be on the safe side, I have regression tested this patch on
HP/UX 11.00, and Tru64 5.1A. No problem.

-- 
Joel

[-- Attachment #2: objfiles.h.diff --]
[-- Type: text/plain, Size: 1679 bytes --]

Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.14
diff -c -3 -p -r1.14 objfiles.h
*** objfiles.h	29 Jul 2002 22:55:26 -0000	1.14
--- objfiles.h	3 Aug 2002 03:09:08 -0000
***************
*** 23,29 ****
  #if !defined (OBJFILES_H)
  #define OBJFILES_H
  
! #include "gdb_obstack.h"		/* For obstack internals.  */
  struct bcache;
  
  /* This structure maintains information on a per-objfile basis about the
--- 23,31 ----
  #if !defined (OBJFILES_H)
  #define OBJFILES_H
  
! #include "gdb_obstack.h"	/* For obstack internals.  */
! #include "symfile.h"		/* For struct psymbol_allocation_list */
! 
  struct bcache;
  
  /* This structure maintains information on a per-objfile basis about the
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.228
diff -c -3 -p -r1.228 Makefile.in
*** Makefile.in	30 Jul 2002 19:59:06 -0000	1.228
--- Makefile.in	3 Aug 2002 03:09:10 -0000
*************** macrotab_h =    macrotab.h
*** 656,662 ****
  macroscope_h =  macroscope.h $(macrotab_h) $(symtab_h)
  memattr_h =     memattr.h
  monitor_h =	monitor.h
! objfiles_h =	objfiles.h $(gdb_obstack_h)
  parser_defs_h =	parser-defs.h $(doublest_h)
  ppc_tdep_h =	ppc-tdep.h osabi.h
  regcache_h =	regcache.h
--- 656,662 ----
  macroscope_h =  macroscope.h $(macrotab_h) $(symtab_h)
  memattr_h =     memattr.h
  monitor_h =	monitor.h
! objfiles_h =	objfiles.h $(gdb_obstack_h) $(symfile_h)
  parser_defs_h =	parser-defs.h $(doublest_h)
  ppc_tdep_h =	ppc-tdep.h osabi.h
  regcache_h =	regcache.h

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

* Re: [RFA] Missing #include in objfiles.h?
  2002-08-02 20:10   ` Joel Brobecker
@ 2002-08-03 16:25     ` Andrew Cagney
  2002-08-05  9:18       ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-08-03 16:25 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> On Thu, Aug 01, 2002 at 04:48:05PM -0400, Andrew Cagney wrote:
> 
>> >I'm not sure if this is intended or not, but objfiles.h relies on
>> >symfile.h for the definition of certain structures. However, objfiles
>> >does not #include symfile. So my attempt to include objfiles without
>> >prior including symfile caused a compilation error. 
> 
>> 
>> What exactly?  A mindless grep suggests opaque references but not a hard 
>> dependency.  Adding an opaque ``struct sym_fns;'' to avoid an include is ok.
> 
> 
> Here are the fields in struct objfile that cause the compilation error:
> 
>     /* Vectors of all partial symbols read in from file.  The actual data
>        is stored in the psymbol_obstack. */
> 
>     struct psymbol_allocation_list global_psymbols;
>     struct psymbol_allocation_list static_psymbols;
> 
> So the full definition is need for this file to compile.

Ah!  In that case, yes definitly.

Andrew



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

* Re: [RFA] Missing #include in objfiles.h?
  2002-08-03 16:25     ` Andrew Cagney
@ 2002-08-05  9:18       ` Joel Brobecker
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2002-08-05  9:18 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

>> 2002-08-05  Joel Brobecker  <brobecker@gnat.com>
>> 
>>     * objfiles.h: Add missing #include "symfile.h"
>> 
>>     * Makefile.in (objfiles_h): Add dependency on symfile.h and dependents.
>
> Ah!  In that case, yes definitly.

Thank you, it's in.

-- 
Joel


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

end of thread, other threads:[~2002-08-05 16:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-01 12:28 [RFA] Missing #include in objfiles.h? Joel Brobecker
2002-08-01 13:48 ` Andrew Cagney
2002-08-02 20:10   ` Joel Brobecker
2002-08-03 16:25     ` Andrew Cagney
2002-08-05  9:18       ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox