[00/13] Splut rank_one_type in smaller functions

Message ID 20190227200028.27360-1-simon.marchi@efficios.com
Headers show
Series
  • Splut rank_one_type in smaller functions
Related show

Message

Simon Marchi Feb. 27, 2019, 8 p.m.
The initial reason for this series is to investigate the following error
I get when building on Ubuntu 18.04, using the default compiler (gcc
(Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0).

  CXX    gdbtypes.o
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c: In function ‘rank rank_one_type(type*, type*, value*)’:
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c:4259:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^

I wanted to see if this was a false positive specific to this gcc
version (I assume it is, since I haven't seen anybody report this error
before).  To do that, I started to manually verify each execution path
of that function and see if execution can really reach the end.
However, due to the size and complexity of the switch in that function,
it was not very practical.  So I started to split that switch in smaller
functions (one per type code of PARM).  At some point, the error
disappeared.  It turns out that it's the last patch that makes the error
disappear.

But still, I think this series is useful, since it gets rid of a false
positive error and makes the code a little bit more readable at the same
time.

Copyright assignment status: I am currently not covered by a copyright
assignment, so I will push this once it is sorted out.  This series
might now actually be significant w.r.t. copyright, since it is just
moving some code around, but in any case it is not really urgent to
merge it either.

I ran this series through the buildbot, it reported no new failure.

Simon Marchi (13):
  Split rank_one_type_parm_ptr from rank_one_type
  Split rank_one_type_parm_array from rank_one_type
  Split rank_one_type_parm_func from rank_one_type
  Split rank_one_type_parm_int from rank_one_type
  Split rank_one_type_parm_enum from rank_one_type
  Split rank_one_type_parm_char from rank_one_type
  Split rank_one_type_parm_range from rank_one_type
  Split rank_one_type_parm_bool from rank_one_type
  Split rank_one_type_parm_float from rank_one_type
  Split rank_one_type_parm_complex from rank_one_type
  Split rank_one_type_parm_struct from rank_one_type
  Split rank_one_type_parm_set from rank_one_type
  Remove unnecessary cases from rank_one_type's switch

 gdb/gdbtypes.c | 742 ++++++++++++++++++++++++++-----------------------
 1 file changed, 400 insertions(+), 342 deletions(-)

-- 
2.21.0

Comments

Tom Tromey Feb. 27, 2019, 9:46 p.m. | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:


Simon> But still, I think this series is useful, since it gets rid of a false
Simon> positive error and makes the code a little bit more readable at the same
Simon> time.

I think so too.  I spot-checked this and it seems fine to me.

Tom
Simon Marchi March 9, 2019, 1:30 p.m. | #2
On 2019-02-27 4:46 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

> 

> Simon> But still, I think this series is useful, since it gets rid of a false

> Simon> positive error and makes the code a little bit more readable at the same

> Simon> time.

> 

> I think so too.  I spot-checked this and it seems fine to me.

> 

> Tom

> 


Thanks, I pushed this patch series.

Simon