bugGNU Gengen - Bugs: bug #56430, parentheses errors

 
 

bug #56430: parentheses errors

Submitter:  Gray Wolf <gray_wolf>
Submitted:  Mon 03 Jun 2019 12:02:09 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 03 Jun 2019 12:02:09 PM UTC, original submission:  

When comparing string argument with string, gengen produces code that generates parentheses errors when compiled with -Wall -Wextra. Minimal reproduction example:


+   $ echo '@if@ a:string = "" @then@ ; @else@ ; @endif@' | gengen --output-format=c > /tmp/test.c | gcc -Wall -Wextra -c -o /dev/null /tmp/test.c
/tmp/test.c: In function ‘generate_gengen’:
/tmp/test.c:53:46: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
   if (( record->a && strcmp( record->a, "" ) == 0== 0 ))
                      ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/tmp/test.c: In function ‘genstring_gengen’:
/tmp/test.c:93:46: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
   if (( record->a && strcmp( record->a, "" ) == 0== 0 ))
                      ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/tmp/test.c: In function ‘strcnt_gengen’:
/tmp/test.c:124:44: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
 if (( record->a && strcmp( record->a, "" ) == 0== 0 ))
                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/tmp/test.c:120:62: warning: unused parameter ‘indent’ [-Wunused-parameter]
 strcnt_gengen(struct gengen_gen_struct *record, unsigned int indent)
                                                 ~~~~~~~~~~~~~^~~~~~


Gray Wolf <gray_wolf>

 

(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 gray_wolf (Submitted 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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code