Changeset da09ba1


Ignore:
Timestamp:
May 1, 2019, 5:01:29 PM (5 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3e96559
Parents:
5157ba7
Message:

attribute((unused)) on nameless parameters.

Location:
src/CodeGen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r5157ba7 rda09ba1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May  1 10:06:00 2019
    13 // Update Count     : 495
     12// Last Modified On : Wed May  1 15:50:00 2019
     13// Update Count     : 496
    1414//
    1515#include "CodeGenerator.h"
     
    181181                functionDecl->get_funcSpec().print( output );
    182182
    183                 output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), options.pretty, options.genC );
     183                Options subOptions = options;
     184                subOptions.inParameterList = true;
     185                output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), subOptions );
    184186
    185187                asmName( functionDecl );
     
    200202                        static UniqueName name = { "__anonymous_object" };
    201203                        objectDecl->set_name( name.newName() );
     204            // Stops unused parameter warnings.
     205            if ( options.inParameterList ) {
     206                objectDecl->attributes.push_back( new Attribute( "unused" ) );
     207            }
    202208                }
    203209
  • src/CodeGen/Options.h

    r5157ba7 rda09ba1  
    1010// Created On       : Tue Apr 30 11:36:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May  1 09:51:00 2019
    13 // Update Count     : 0
     12// Last Modified On : Wed May  1 15:52:00 2019
     13// Update Count     : 1
    1414//
    1515
     
    2424                bool printExprTypes;
    2525
     26                // Internal Options: Changed on some recurisive calls.
     27                bool inParameterList = false;
     28
    2629                Options(bool pretty, bool genC, bool lineMarks, bool printExprTypes) :
    2730                        pretty(pretty), genC(genC), lineMarks(lineMarks), printExprTypes(printExprTypes)
Note: See TracChangeset for help on using the changeset viewer.