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

 
 

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

Submitted by:  None
Submitted on:  Tue 21 Apr 2015 12:03:28 AM UTC  
 
Category: Generated codeSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Nov 2016 01:22:24 AM UTChaibleStatusNone=>Fixed
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed
    Thu 24 Nov 2016 12:08:50 AM UTChaibleCategoryNone=>Generated code

    Back to the top


    Powered by Savane 3.1-cleanup1