buggperf - Bugs: bug #44887, Clang warnings in C++ generated...

 
 

bug #44887: Clang warnings in C++ generated code

Submitter:  None
Submitted:  Tue 21 Apr 2015 12:03:28 AM UTC
   
 
Category:  Generated code Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 26 Nov 2016 01:22:24 AM UTC, comment #1: 

Thanks for the hints. I've added changes that should make these warnings go away.

> register qualifiers are deprecated in C++11, so will be good idea to have options to generate code without them.


Thanks for this hint as well. The 'register' keyword is still useful in C (namely with gcc -O0), though:
http://softwareengineering.stackexchange.com/questions/206378/when-is-the-register-keyword-actually-useful-in-c/251667#251667
https://gcc.gnu.org/ml/gcc/2010-05/msg00116.html

Bruno Haible <haible>
Group administrator
Tue 21 Apr 2015 12:03:28 AM UTC, original submission:  

Hi!

I got next Clang warnings in generated code:

Test.gp:77:23: warning: implicit conversion changes signedness: 'unsigned int' to 'int' [-Wsign-conversion]
  register int hval = len;
               ~~~~   ^~~
Test.gp:82:29: warning: use of old-style cast [-Wold-style-cast]
        hval += asso_values[(unsigned char)str[4]];
                            ^              ~~~~~~
Test.gp:97:10: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]
  return hval;
  ~~~~~~ ^~~~
Test.gp:46:26: warning: implicit conversion changes signedness: 'unsigned int' to 'int' [-Wsign-conversion]
      register int key = getHash (str, len);
                   ~~~   ^~~~~~~~~~~~~~~~~~

I'm not sure that int-unsigned int-int conversion is necessary. If yes, static_cast should be used, if not, unsigned int should be used consistently.

register qualifiers are deprecated in C++11, so will be good idea to have options to generate code without them.

Eugene.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed Fix Released
    2016-11-26 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2016-11-24 haible CategoryNone Generated code

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code