Changeset 46adb83 for src


Ignore:
Timestamp:
Aug 8, 2017, 8:09:05 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
1744e6d
Parents:
533804b
Message:

Add unused attribute to union ctor/dtor parameters to silence warnings

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    r533804b r46adb83  
    1717#include <iterator>
    1818#include "SynTree/Visitor.h"
     19#include "SynTree/Attribute.h"
    1920#include "SynTree/Type.h"
    2021#include "SynTree/Statement.h"
     
    275276                // void ?{}(E *, E);
    276277                FunctionType *copyCtorType = genCopyType( refType->clone() );
     278
     279                // add unused attribute to parameters of default constructor and destructor
     280                ctorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
     281                dtorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
    277282
    278283                // xxx - should we also generate void ?{}(E *, int) and E ?{}(E *, E)?
     
    516521                cloneAll( typeParams, assignType->get_forall() );
    517522
     523                // add unused attribute to parameters of default constructor and destructor
     524                ctorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
     525                dtorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
     526
    518527                // Routines at global scope marked "static" to prevent multiple definitions is separate translation units
    519528                // because each unit generates copies of the default routines for each aggregate.
  • src/tests/.expect/64/attributes.txt

    r533804b r46adb83  
    310310        __R__C13e__anonymous5_2,
    311311    };
    312     inline void ___constructor__F_R13e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2){
     312    inline void ___constructor__F_R13e__anonymous5_intrinsic___2(__attribute__ ((unused)) enum __anonymous5 *___dst__R13e__anonymous5_2){
    313313    }
    314314    inline void ___constructor__F_R13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    315315        ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2));
    316316    }
    317     inline void ___destructor__F_R13e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2){
     317    inline void ___destructor__F_R13e__anonymous5_intrinsic___2(__attribute__ ((unused)) enum __anonymous5 *___dst__R13e__anonymous5_2){
    318318    }
    319319    inline enum __anonymous5 ___operator_assign__F13e__anonymous5_R13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
  • src/tests/.expect/64/extension.txt

    r533804b r46adb83  
    6060    __extension__ int __c__i_1;
    6161};
    62 static inline void ___constructor__F_R2uU_autogen___1(union U *___dst__R2uU_1){
     62static inline void ___constructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1){
    6363}
    6464static inline void ___constructor__F_R2uU2uU_autogen___1(union U *___dst__R2uU_1, union U ___src__2uU_1){
    6565    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));
    6666}
    67 static inline void ___destructor__F_R2uU_autogen___1(union U *___dst__R2uU_1){
     67static inline void ___destructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1){
    6868}
    6969static inline union U ___operator_assign__F2uU_R2uU2uU_autogen___1(union U *___dst__R2uU_1, union U ___src__2uU_1){
     
    7373    return ((union U )___ret__2uU_1);
    7474}
    75 static inline void ___constructor__F_R2uUi_autogen___1(union U *___dst__R2uU_1, int __src__i_1){
     75static inline void ___constructor__F_R2uUi_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1, int __src__i_1){
    7676    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__src__i_1)), sizeof(int )));
    7777}
Note: See TracChangeset for help on using the changeset viewer.