Changeset b3c36f4


Ignore:
Timestamp:
Jun 5, 2017, 11:43:18 AM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
7e003011
Parents:
fa21ac9
Message:

Added some attribute((unused)) where appropriate

Location:
src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/TrackLoc.cc

    rfa21ac9 rb3c36f4  
    8585                }
    8686
    87                 void postvisit(BaseSyntaxNode * node) {
     87                void postvisit( __attribute__((unused)) BaseSyntaxNode * node ) {
    8888                        parents.pop();
    8989                }
  • src/Common/Assert.cc

    rfa21ac9 rb3c36f4  
    2121extern const char * __progname;                                                 // global name of running executable (argv[0])
    2222
    23 #define CFA_ASSERT_FMT "*CFA assertion error* from program \"%s\" in \"%s\" at line %d in file \"%s\""
     23#define CFA_ASSERT_FMT "*CFA assertion error* \"%s\" from program \"%s\" in \"%s\" at line %d in file \"%s\""
    2424
    2525// called by macro assert in assert.h
    2626void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) {
    27         fprintf( stderr, CFA_ASSERT_FMT ".\n", __progname, function, line, file );
     27        fprintf( stderr, CFA_ASSERT_FMT ".\n", assertion, __progname, function, line, file );
    2828        abort();
    2929}
     
    3131// called by macro assertf
    3232void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) {
    33         fprintf( stderr, CFA_ASSERT_FMT ": ", __progname, function, line, file );
     33        fprintf( stderr, CFA_ASSERT_FMT ": ", assertion, __progname, function, line, file );
    3434        va_list args;
    3535        va_start( args, fmt );
  • src/Common/PassVisitor.proto.h

    rfa21ac9 rb3c36f4  
    2323
    2424template<typename pass_type, typename node_type>
    25 static inline void previsit_impl( __attribute__((unused)) pass_type& pass, node_type * node, __attribute__((unused)) long unused ) {}
     25static inline void previsit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    2626
    2727
     
    3232
    3333template<typename pass_type, typename node_type>
    34 static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, node_type * node, __attribute__((unused)) long unused ) {}
     34static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    3535
    3636// Mutate
     
    4141
    4242template<typename pass_type, typename node_type>
    43 static inline void premutate_impl( __attribute__((unused)) pass_type& pass, node_type * node, __attribute__((unused)) long unused ) {}
     43static inline void premutate_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    4444
    4545
     
    7171
    7272// Fields
    73 #define FIELD_PTR( type, name )                                                                                                                  \
    74 template<typename pass_type>                                                                                                                     \
    75 static inline auto name##_impl( pass_type& pass, __attribute__((unused)) int unused ) ->decltype( &pass.name ) { return &pass.name; }          \
    76                                                                                                                                                  \
    77 template<typename pass_type>                                                                                                                     \
     73#define FIELD_PTR( type, name )                                                                                                        \
     74template<typename pass_type>                                                                                                           \
     75static inline auto name##_impl( pass_type& pass, __attribute__((unused)) int unused ) ->decltype( &pass.name ) { return &pass.name; }  \
     76                                                                                                                                       \
     77template<typename pass_type>                                                                                                           \
    7878static inline type * name##_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) { return nullptr;}    \
    7979
  • src/Parser/ParseNode.h

    rfa21ac9 rb3c36f4  
    6161        }
    6262
    63         virtual void print( std::ostream &os, int indent = 0 ) const {}
    64         virtual void printList( std::ostream &os, int indent = 0 ) const {}
     63        virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
     64        virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
    6565
    6666        static int indent_by;
     
    113113        ExpressionNode * set_extension( bool exten ) { extension = exten; return this; }
    114114
    115         virtual void print( std::ostream &os, int indent = 0 ) const override {}
    116         void printOneLine( std::ostream &os, int indent = 0 ) const {}
     115        virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {}
     116        void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
    117117
    118118        template<typename T>
     
    283283        }
    284284
    285         virtual void print( std::ostream &os, int indent = 0 ) const override;
    286         virtual void printList( std::ostream &os, int indent = 0 ) const override;
     285        virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override;
     286        virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override;
    287287
    288288        Declaration * build() const;
     
    363363        virtual StatementNode * append_last_case( StatementNode * );
    364364
    365         virtual void print( std::ostream &os, int indent = 0 ) const override {}
    366         virtual void printList( std::ostream &os, int indent = 0 ) const override {}
     365        virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {}
     366        virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {}
    367367  private:
    368368        std::unique_ptr<Statement> stmt;
  • src/SynTree/Statement.cc

    rfa21ac9 rb3c36f4  
    3030Statement::Statement( std::list<Label> _labels ) : labels( _labels ) {}
    3131
    32 void Statement::print( std::ostream &, int indent ) const {}
     32void Statement::print( __attribute__((unused)) std::ostream &, __attribute__((unused)) int indent ) const {}
    3333
    3434Statement::~Statement() {}
     
    365365NullStmt::NullStmt() : CompoundStmt( std::list<Label>() ) {}
    366366
    367 void NullStmt::print( std::ostream &os, int indent ) const {
     367void NullStmt::print( std::ostream &os, __attribute__((unused)) int indent ) const {
    368368        os << "Null Statement" << endl ;
    369369}
  • src/SynTree/Type.h

    rfa21ac9 rb3c36f4  
    334334        virtual void print( std::ostream & os, int indent = 0 ) const;
    335335
    336         virtual void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const {}
     336        virtual void lookup( __attribute__((unused)) const std::string & name, __attribute__((unused)) std::list< Declaration* > & foundDecls ) const {}
    337337  protected:
    338338        virtual std::string typeString() const = 0;
  • src/SynTree/Visitor.cc

    rfa21ac9 rb3c36f4  
    122122}
    123123
    124 void Visitor::visit( BranchStmt *branchStmt ) {
     124void Visitor::visit( __attribute__((unused)) BranchStmt *branchStmt ) {
    125125}
    126126
     
    143143}
    144144
    145 void Visitor::visit( NullStmt *nullStmt ) {
     145void Visitor::visit( __attribute__((unused)) NullStmt *nullStmt ) {
    146146}
    147147
     
    445445
    446446
    447 void Visitor::visit( Subrange *subrange ) {}
    448 
    449 
    450 void Visitor::visit( Constant *constant ) {}
     447void Visitor::visit( __attribute__((unused)) Subrange *subrange ) {}
     448
     449
     450void Visitor::visit( __attribute__((unused)) Constant *constant ) {}
    451451// Local Variables: //
    452452// tab-width: 4 //
  • src/driver/cc1.cc

    rfa21ac9 rb3c36f4  
    8484
    8585
    86 void sigTermHandler( int signal ) {
     86void sigTermHandler( __attribute__((unused)) int signal ) {
    8787        if ( tmpfilefd != -1 ) {                                                        // RACE, file created ?
    8888                rmtmpfile();                                                                    // remove
     
    469469
    470470
    471 int main( const int argc, const char * const argv[], const char * const env[] ) {
     471int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    472472#ifdef __DEBUG_H__
    473473        for ( int i = 0; env[i] != NULL; i += 1 ) {
  • src/main.cc

    rfa21ac9 rb3c36f4  
    146146} // sigSegvBusHandler
    147147
    148 void sigAbortHandler( int sig_num ) {
     148void sigAbortHandler( __attribute__((unused)) int sig_num ) {
    149149        backtrace( 6 );                                                                         // skip first 6 stack frames
    150150        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
Note: See TracChangeset for help on using the changeset viewer.