Changeset 76f7fc7


Ignore:
Timestamp:
May 2, 2019, 1:57:05 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
62ce290
Parents:
3e96559
Message:

Reduced cases where unused is placed on anonymous objects. Regenerated tests.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r3e96559 r76f7fc7  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May  1 15:50:00 2019
    13 // Update Count     : 496
     12// Last Modified On : Thr May  2 10:47:00 2019
     13// Update Count     : 497
    1414//
    1515#include "CodeGenerator.h"
     
    182182
    183183                Options subOptions = options;
    184                 subOptions.inParameterList = true;
     184                subOptions.anonymousUnused = functionDecl->has_body();
    185185                output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), subOptions );
    186186
     
    203203                        objectDecl->set_name( name.newName() );
    204204            // Stops unused parameter warnings.
    205             if ( options.inParameterList ) {
     205            if ( options.anonymousUnused ) {
    206206                objectDecl->attributes.push_back( new Attribute( "unused" ) );
    207207            }
  • src/CodeGen/Options.h

    r3e96559 r76f7fc7  
    1010// Created On       : Tue Apr 30 11:36:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May  1 15:52:00 2019
    13 // Update Count     : 1
     12// Last Modified On : Thr May  2 10:45:00 2019
     13// Update Count     : 2
    1414//
    1515
     
    2525
    2626                // Internal Options: Changed on some recurisive calls.
    27                 bool inParameterList = false;
     27                bool anonymousUnused = false;
    2828
    2929                Options(bool pretty, bool genC, bool lineMarks, bool printExprTypes) :
  • src/SynTree/Declaration.h

    r3e96559 r76f7fc7  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May  1 07:46:49 2019
    13 // Update Count     : 134
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr May  2 10:47:00 2019
     13// Update Count     : 135
    1414//
    1515
     
    167167        CompoundStmt *get_statements() const { return statements; }
    168168        void set_statements( CompoundStmt *newValue ) { statements = newValue; }
     169        bool has_body() const { return NULL != statements; }
    169170
    170171        static FunctionDecl * newFunction( const std::string & name, FunctionType * type, CompoundStmt * statements );
  • tests/.expect/KRfunctions.x64.txt

    r3e96559 r76f7fc7  
    4444    __attribute__ ((unused)) signed int _X10_retval_f5i_1;
    4545}
    46 signed int (*_X2f6FFi_i__iPiPi__1(signed int _X1ai_1, signed int *_X1bPi_1, signed int *_X1cPi_1))(signed int __anonymous_object0){
     46signed int (*_X2f6FFi_i__iPiPi__1(signed int _X1ai_1, signed int *_X1bPi_1, signed int *_X1cPi_1))(__attribute__ ((unused)) signed int __anonymous_object0){
    4747    __attribute__ ((unused)) signed int (*_X10_retval_f6Fi_i__1)(signed int __anonymous_object1);
    4848}
  • tests/.expect/attributes.x64.txt

    r3e96559 r76f7fc7  
    271271}
    272272__attribute__ ((unused,used,unused)) signed int (*_X2f4FFi_i____1())(signed int __anonymous_object1);
    273 __attribute__ ((unused,unused)) signed int (*_X2f4FFi_i____1())(signed int __anonymous_object2){
     273__attribute__ ((unused,unused)) signed int (*_X2f4FFi_i____1())(__attribute__ ((unused)) signed int __anonymous_object2){
    274274    __attribute__ ((unused)) signed int (*_X10_retval_f4Fi_i__1)(signed int __anonymous_object3);
    275275}
  • tests/.expect/functions.x64.txt

    r3e96559 r76f7fc7  
    11void _X1hFv___1(void){
    22}
    3 signed int _X1fFi_Fi__Fi_i_Fi__Fi_i_Fv____1(signed int (*__anonymous_object0)(void), signed int (*__anonymous_object1)(signed int __anonymous_object2), signed int (*__anonymous_object3)(void), signed int (*__anonymous_object4)(signed int __anonymous_object5), void (*_X1gFv___1)(void)){
     3signed int _X1fFi_Fi__Fi_i_Fi__Fi_i_Fv____1(__attribute__ ((unused)) signed int (*__anonymous_object0)(void), __attribute__ ((unused)) signed int (*__anonymous_object1)(signed int __anonymous_object2), __attribute__ ((unused)) signed int (*__anonymous_object3)(void), __attribute__ ((unused)) signed int (*__anonymous_object4)(signed int __anonymous_object5), void (*_X1gFv___1)(void)){
    44    __attribute__ ((unused)) signed int _X9_retval_fi_1;
    55    ((void)(*_X1gFv___1)());
     
    9090    __attribute__ ((unused)) signed int _X9_retval_fi_1;
    9191}
    92 signed int _X1fFi_i__1(signed int __anonymous_object7){
     92signed int _X1fFi_i__1(__attribute__ ((unused)) signed int __anonymous_object7){
    9393    __attribute__ ((unused)) signed int _X9_retval_fi_1;
    9494}
     
    121121    __attribute__ ((unused)) struct _conc__tuple2_0 _X9_retval_fT2ii_1 = {  };
    122122}
    123 struct _conc__tuple2_0 _X1fFT2ii_ii__1(signed int __anonymous_object9, signed int _X1xi_1){
     123struct _conc__tuple2_0 _X1fFT2ii_ii__1(__attribute__ ((unused)) signed int __anonymous_object9, signed int _X1xi_1){
    124124    __attribute__ ((unused)) struct _conc__tuple2_0 _X9_retval_fT2ii_1 = {  };
    125125}
     
    158158    __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = {  };
    159159}
    160 struct _conc__tuple3_1 _X1fFT3iii_iii__1(signed int __anonymous_object12, signed int _X1xi_1, signed int __anonymous_object13){
     160struct _conc__tuple3_1 _X1fFT3iii_iii__1(__attribute__ ((unused)) signed int __anonymous_object12, signed int _X1xi_1, __attribute__ ((unused)) signed int __anonymous_object13){
    161161    __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = {  };
    162162}
     
    171171    __attribute__ ((unused)) struct _conc__tuple3_2 _X9_retval_fT3iiPi_1 = {  };
    172172}
    173 struct _conc__tuple3_2 _X1fFT3iiPi_iiPi__1(signed int __anonymous_object15, signed int _X1xi_1, signed int *_X1yPi_1){
     173struct _conc__tuple3_2 _X1fFT3iiPi_iiPi__1(__attribute__ ((unused)) signed int __anonymous_object15, signed int _X1xi_1, signed int *_X1yPi_1){
    174174    __attribute__ ((unused)) struct _conc__tuple3_2 _X9_retval_fT3iiPi_1 = {  };
    175175}
     
    181181const double _X3fooFd___1(void);
    182182const double _X3fooFd_i__1(signed int __anonymous_object19);
    183 const double _X3fooFd_d__1(double __anonymous_object20){
     183const double _X3fooFd_d__1(__attribute__ ((unused)) double __anonymous_object20){
    184184    __attribute__ ((unused)) const double _X11_retval_fooKd_1;
    185185    ((void)((*((double *)(&_X11_retval_fooKd_1)))=3.0) /* ?{} */);
     
    212212    ((void)((*_X4_dstS1S_1)._X1ii_1=_X1ii_1) /* ?{} */);
    213213}
    214 struct S _X3rtnFS1S_i__1(signed int __anonymous_object21){
     214struct S _X3rtnFS1S_i__1(__attribute__ ((unused)) signed int __anonymous_object21){
    215215    __attribute__ ((unused)) struct S _X11_retval_rtnS1S_1;
    216216}
    217 signed int _X1fFi_Fi_ii_Fi_i___1(signed int (*__anonymous_object22)(signed int __anonymous_object23, signed int _X1pi_1), signed int (*__anonymous_object24)(signed int __anonymous_object25)){
     217signed int _X1fFi_Fi_ii_Fi_i___1(__attribute__ ((unused)) signed int (*__anonymous_object22)(signed int __anonymous_object23, signed int _X1pi_1), __attribute__ ((unused)) signed int (*__anonymous_object24)(signed int __anonymous_object25)){
    218218    __attribute__ ((unused)) signed int _X9_retval_fi_1;
    219219    signed int (*(*_X2pcPA0A0PA0A0i_2)[][((unsigned long int )10)])[][((unsigned long int )3)];
     
    241241}
    242242signed int _X1fFi_Fi__FPi__FPPi__FPKPi__FPKPi__PiPiPPiPPiPPPiPPPiPPKPiPPKPiPKPKPiPKPKPi__1(signed int (*__anonymous_object27)(), signed int *(*__anonymous_object28)(), signed int **(*__anonymous_object29)(), signed int *const *(*__anonymous_object30)(), signed int *const *const (*__anonymous_object31)(), signed int *__anonymous_object32, signed int __anonymous_object33[((unsigned long int )10)], signed int **__anonymous_object34, signed int *__anonymous_object35[((unsigned long int )10)], signed int ***__anonymous_object36, signed int **__anonymous_object37[((unsigned long int )10)], signed int *const **__anonymous_object38, signed int *const *__anonymous_object39[((unsigned long int )10)], signed int *const *const *__anonymous_object40, signed int *const *const __anonymous_object41[((unsigned long int )10)]);
    243 signed int _X1fFi_Fi__FPi__FPPi__FPKPi__FPKPi__PiPiPPiPPiPPPiPPPiPPKPiPPKPiPKPKPiPKPKPi__1(signed int (*__anonymous_object42)(), signed int *(*__anonymous_object43)(), signed int **(*__anonymous_object44)(), signed int *const *(*__anonymous_object45)(), signed int *const *const (*__anonymous_object46)(), signed int *__anonymous_object47, signed int __anonymous_object48[((unsigned long int )10)], signed int **__anonymous_object49, signed int *__anonymous_object50[((unsigned long int )10)], signed int ***__anonymous_object51, signed int **__anonymous_object52[((unsigned long int )10)], signed int *const **__anonymous_object53, signed int *const *__anonymous_object54[((unsigned long int )10)], signed int *const *const *__anonymous_object55, signed int *const *const __anonymous_object56[((unsigned long int )10)]){
     243signed int _X1fFi_Fi__FPi__FPPi__FPKPi__FPKPi__PiPiPPiPPiPPPiPPPiPPKPiPPKPiPKPKPiPKPKPi__1(__attribute__ ((unused)) signed int (*__anonymous_object42)(), __attribute__ ((unused)) signed int *(*__anonymous_object43)(), __attribute__ ((unused)) signed int **(*__anonymous_object44)(), __attribute__ ((unused)) signed int *const *(*__anonymous_object45)(), __attribute__ ((unused)) signed int *const *const (*__anonymous_object46)(), __attribute__ ((unused)) signed int *__anonymous_object47, __attribute__ ((unused)) signed int __anonymous_object48[((unsigned long int )10)], __attribute__ ((unused)) signed int **__anonymous_object49, __attribute__ ((unused)) signed int *__anonymous_object50[((unsigned long int )10)], __attribute__ ((unused)) signed int ***__anonymous_object51, __attribute__ ((unused)) signed int **__anonymous_object52[((unsigned long int )10)], __attribute__ ((unused)) signed int *const **__anonymous_object53, __attribute__ ((unused)) signed int *const *__anonymous_object54[((unsigned long int )10)], __attribute__ ((unused)) signed int *const *const *__anonymous_object55, __attribute__ ((unused)) signed int *const *const __anonymous_object56[((unsigned long int )10)]){
    244244    __attribute__ ((unused)) signed int _X9_retval_fi_1;
    245245}
Note: See TracChangeset for help on using the changeset viewer.