Changeset d7312ac


Ignore:
Timestamp:
May 5, 2018, 9:33:28 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, with_gc
Children:
7867eb9
Parents:
43c461d
Message:

make directives work and use them to remove warnings

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r43c461d rd7312ac  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 20:42:52 2017
    13 // Update Count     : 490
     12// Last Modified On : Sat May  5 09:08:32 2018
     13// Update Count     : 494
    1414//
    1515#include "CodeGenerator.h"
     
    370370
    371371        void CodeGenerator::postvisit( Constant * constant ) {
    372                 output << constant->get_value() ;
     372                output << constant->get_value();
    373373        }
    374374
     
    587587                output << "(";
    588588                if ( castExpr->get_result()->isVoid() ) {
    589                         output << "(void)" ;
     589                        output << "(void)";
    590590                } else {
    591591                        // at least one result type of cast.
     
    878878                        } // for
    879879                } // if
    880                 output << " );" ;
     880                output << " );";
    881881        }
    882882
     
    886886                output << "( ";
    887887                if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor );
    888                 output << " )" ;
     888                output << " )";
    889889        }
    890890
    891891        void CodeGenerator::postvisit( DirectiveStmt * dirStmt ) {
    892                 output << dirStmt->directive;
     892                output << endl << dirStmt->directive;                   // endl prevents spaces before directive
    893893        }
    894894
     
    907907
    908908        void CodeGenerator::postvisit( SwitchStmt * switchStmt ) {
    909                 output << "switch ( " ;
     909                output << "switch ( ";
    910910                switchStmt->get_condition()->accept( *visitor );
    911911                output << " ) ";
     
    933933                ++indent;
    934934                for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
    935                         output << indent << printLabels( (*i)->get_labels() )  ;
     935                        output << indent << printLabels( (*i)->get_labels() ) ;
    936936                        (*i)->accept( *visitor );
    937937                        output << endl;
     
    10701070        void CodeGenerator::postvisit( WhileStmt * whileStmt ) {
    10711071                if ( whileStmt->get_isDoWhile() ) {
    1072                         output << "do" ;
    1073                 } else {
    1074                         output << "while (" ;
     1072                        output << "do";
     1073                } else {
     1074                        output << "while (";
    10751075                        whileStmt->get_condition()->accept( *visitor );
    10761076                        output << ")";
     
    10841084
    10851085                if ( whileStmt->get_isDoWhile() ) {
    1086                         output << " while (" ;
     1086                        output << " while (";
    10871087                        whileStmt->get_condition()->accept( *visitor );
    10881088                        output << ");";
  • src/libcfa/interpose.c

    r43c461d rd7312ac  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri May  4 14:35:13 2018
    13 // Update Count     : 97
     12// Last Modified On : Sat May  5 09:16:57 2018
     13// Update Count     : 99
    1414//
    1515
     
    8585
    8686struct {
    87         void (* exit)( int ) __attribute__ (( __noreturn__ ));
    88         void (* abort)( void ) __attribute__ (( __noreturn__ ));
     87        void (* exit)( int ) __attribute__(( __noreturn__ ));
     88        void (* abort)( void ) __attribute__(( __noreturn__ ));
    8989} __cabi_libc;
    9090
     
    9494                const char *version = NULL;
    9595
     96#pragma GCC diagnostic push
     97#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
    9698                INTERPOSE_LIBC( abort, version );
    9799                INTERPOSE_LIBC( exit , version );
     100#pragma GCC diagnostic pop
    98101
    99102                __cfaabi_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO ); // Failure handler
     
    112115
    113116// Forward declare abort after the __typeof__ call to avoid ambiguities
    114 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
    115 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
     117void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
     118void abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    116119
    117120extern "C" {
    118         void abort( void ) __attribute__ (( __nothrow__, __leaf__, __noreturn__ )) {
     121        void abort( void ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) {
    119122                abort( NULL );
    120123        }
    121124
    122         void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
     125        void __cabi_abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
    123126                va_list argp;
    124127                va_start( argp, fmt );
     
    127130        }
    128131
    129         void exit( int status ) __attribute__ (( __nothrow__, __leaf__, __noreturn__ )) {
     132        void exit( int status ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) {
    130133                __cabi_libc.exit( status );
    131134        }
    132135}
    133136
    134 void * kernel_abort    ( void ) __attribute__ (( __nothrow__, __leaf__, __weak__ )) { return NULL; }
    135 void   kernel_abort_msg( void * data, char * buffer, int size ) __attribute__ (( __nothrow__, __leaf__, __weak__ )) {}
    136 int kernel_abort_lastframe( void ) __attribute__ (( __nothrow__, __leaf__, __weak__ )) { return 4; }
     137void * kernel_abort    ( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return NULL; }
     138void   kernel_abort_msg( void * data, char * buffer, int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {}
     139int kernel_abort_lastframe( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 4; }
    137140
    138141enum { abort_text_size = 1024 };
     
    140143static int abort_lastframe;
    141144
    142 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )) {
     145void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )) {
    143146    va_list args;
    144147    va_start( args, fmt );
     
    148151}
    149152
    150 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
     153void abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
    151154        void * kernel_data = kernel_abort();                    // must be done here to lock down kernel
    152155        int len;
  • src/libcfa/time.c

    r43c461d rd7312ac  
    1010// Created On       : Tue Mar 27 13:33:14 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 12 14:41:00 2018
    13 // Update Count     : 22
     12// Last Modified On : Sat May  5 09:04:51 2018
     13// Update Count     : 36
    1414//
    1515
     
    1717#include "iostream"
    1818#include <stdio.h>                                                                              // snprintf
     19#include <assert.h>
    1920
    2021static char * nanomsd( long int ns, char * buf ) {              // most significant digits
     
    8788        time_t s = tv / TIMEGRAN;
    8889        tm tm;
    89         gmtime_r( &s, &tm );
     90        gmtime_r( &s, &tm );                                                            // tm_mon <= 11, tm_mday <= 31
     91#pragma GCC diagnostic push
     92#pragma GCC diagnostic ignored "-Wformat-truncation"
    9093        snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_year % 99, tm.tm_mon + 1, tm.tm_mday );
     94#pragma GCC diagnostic pop
    9195        return buf;
    9296} // yy_mm_dd
     
    9599        time_t s = tv / TIMEGRAN;
    96100        tm tm;
    97         gmtime_r( &s, &tm );
     101        gmtime_r( &s, &tm );                                                            // tm_mon <= 11, tm_mday <= 31
     102#pragma GCC diagnostic push
     103#pragma GCC diagnostic ignored "-Wformat-truncation"
    98104        snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mon + 1, tm.tm_mday, tm.tm_year % 99 );
     105#pragma GCC diagnostic pop
    99106        return buf;
    100107} // mm_dd_yy
     
    103110        time_t s = tv / TIMEGRAN;
    104111        tm tm;
    105         gmtime_r( &s, &tm );
     112        gmtime_r( &s, &tm );                                                            // tm_mon <= 11, tm_mday <= 31
     113#pragma GCC diagnostic push
     114#pragma GCC diagnostic ignored "-Wformat-truncation"
    106115        snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year % 99 );
     116#pragma GCC diagnostic pop
    107117        return buf;
    108118} // dd_mm_yy
Note: See TracChangeset for help on using the changeset viewer.