This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [patch] [gdb/testsuite] include a use of the definition of a type to cause clang to emit debug info


David Blaikie writes:
 > Clang has an optimization that causes a the debug info to only include
 > the declaration of a type if the type is referenced but never used in
 > a context that requires a definition (eg: pointers are handed around
 > but never deferenced).
 > 
 > This patch introduces a variable to one test file to cause clang to
 > emit the full definition of the type as well as fixing up a related
 > typo in the test message of the associated expect file.
 > 
 > Like the difference between GCC and Clang in the emission of unused
 > static entities, I think this case is also a matter of degrees - both
 > GCC and Clang implement other similar optimizations* to the one
 > outlined here and the GDB test suite has managed to pass without
 > disabling those optimizations in GCC and I hope it's suitable to do
 > the same for Clang.
 > 
 > Though admittedly I don't have much of the context of the history of
 > the testsuite, its priorities/preferences when it comes to
 > distinguishing testing compiler behavior versus debugger behavior,
 > etc.
 > 
 > * the one I know of involves dynamic types: both GCC and Clang only
 > emit the debug info definition of such a type in any translation unit
 > that emits the key function. This means in many contexts where a full
 > definition is provided in the source only a declaration is provided in
 > the debug info.
 > commit 1128f6fb45483d45668d09e0696f4a590334e0c4
 > Author: David Blaikie <dblaikie@gmail.com>
 > Date:   Sat Apr 12 23:27:19 2014 -0700
 > 
 >     Cause clang to emit the definition of a type used only by pointer
 >     
 >     gdb/testsuite/
 >     	* gdb.stabs/gdb11479.c: introduce a variable to cause clang to
 >     	emit the full definition of type required by the test
 >     	* gdb.stabs/gdb11479.exp: correct a typo in a test message

ChangeLog conventions require one to document more specifically
where the change occurred.  E.g.,

	* gdb.stabs/gdb11479.c (tag_dummy_enum): New global to cause clang to
	emit the full definition of type required by the test.
	* gdb.stabs/gdb11479.exp (do_test): Correct a typo in a test message.

Plus note the capitalization and period.

Plus conventions also say to specify the "why" of things in source
and not the changelog.  I realize we're not going to the trouble
of adding comments to every non-static function to document why it
has to be non-static.  So I don't see a great need to do so here,
and I'd leave the ChangeLog entry as written.
I'm just writing this down in case the topic comes up.

 > 
 > diff --git gdb/testsuite/ChangeLog gdb/testsuite/ChangeLog
 > index 730c116..07ba18e 100644
 > --- gdb/testsuite/ChangeLog
 > +++ gdb/testsuite/ChangeLog
 > @@ -1,3 +1,9 @@
 > +2014-04-12  David Blaikie  <dblaikie@gmail.com>
 > +
 > +        * gdb.stabs/gdb11479.c: introduce a variable to cause clang to
 > +	emit the full definition of type required by the test
 > +        * gdb.stabs/gdb11479.exp: correct a typo in a test message
 > +

Mix of tabs and spaces.  Just use tabs.

Ok with those changes.


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