Changeset d7312ac
- Timestamp:
- May 5, 2018, 9:33:28 AM (5 years ago)
- Branches:
- aaron-thesis, arm-eh, 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
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r43c461d rd7312ac 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 3 20:42:52 201713 // Update Count : 49 012 // Last Modified On : Sat May 5 09:08:32 2018 13 // Update Count : 494 14 14 // 15 15 #include "CodeGenerator.h" … … 370 370 371 371 void CodeGenerator::postvisit( Constant * constant ) { 372 output << constant->get_value() 372 output << constant->get_value(); 373 373 } 374 374 … … 587 587 output << "("; 588 588 if ( castExpr->get_result()->isVoid() ) { 589 output << "(void)" 589 output << "(void)"; 590 590 } else { 591 591 // at least one result type of cast. … … 878 878 } // for 879 879 } // if 880 output << " );" 880 output << " );"; 881 881 } 882 882 … … 886 886 output << "( "; 887 887 if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor ); 888 output << " )" 888 output << " )"; 889 889 } 890 890 891 891 void CodeGenerator::postvisit( DirectiveStmt * dirStmt ) { 892 output << dirStmt->directive;892 output << endl << dirStmt->directive; // endl prevents spaces before directive 893 893 } 894 894 … … 907 907 908 908 void CodeGenerator::postvisit( SwitchStmt * switchStmt ) { 909 output << "switch ( " 909 output << "switch ( "; 910 910 switchStmt->get_condition()->accept( *visitor ); 911 911 output << " ) "; … … 933 933 ++indent; 934 934 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() ) ; 936 936 (*i)->accept( *visitor ); 937 937 output << endl; … … 1070 1070 void CodeGenerator::postvisit( WhileStmt * whileStmt ) { 1071 1071 if ( whileStmt->get_isDoWhile() ) { 1072 output << "do" 1073 } else { 1074 output << "while (" 1072 output << "do"; 1073 } else { 1074 output << "while ("; 1075 1075 whileStmt->get_condition()->accept( *visitor ); 1076 1076 output << ")"; … … 1084 1084 1085 1085 if ( whileStmt->get_isDoWhile() ) { 1086 output << " while (" 1086 output << " while ("; 1087 1087 whileStmt->get_condition()->accept( *visitor ); 1088 1088 output << ");"; -
src/libcfa/interpose.c
r43c461d rd7312ac 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri May 4 14:35:13201813 // Update Count : 9 712 // Last Modified On : Sat May 5 09:16:57 2018 13 // Update Count : 99 14 14 // 15 15 … … 85 85 86 86 struct { 87 void (* exit)( int ) __attribute__ 88 void (* abort)( void ) __attribute__ 87 void (* exit)( int ) __attribute__(( __noreturn__ )); 88 void (* abort)( void ) __attribute__(( __noreturn__ )); 89 89 } __cabi_libc; 90 90 … … 94 94 const char *version = NULL; 95 95 96 #pragma GCC diagnostic push 97 #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" 96 98 INTERPOSE_LIBC( abort, version ); 97 99 INTERPOSE_LIBC( exit , version ); 100 #pragma GCC diagnostic pop 98 101 99 102 __cfaabi_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO ); // Failure handler … … 112 115 113 116 // Forward declare abort after the __typeof__ call to avoid ambiguities 114 void exit( int status, const char fmt[], ... ) __attribute__ 115 void abort( const char fmt[], ... ) __attribute__ 117 void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )); 118 void abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 116 119 117 120 extern "C" { 118 void abort( void ) __attribute__ 121 void abort( void ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) { 119 122 abort( NULL ); 120 123 } 121 124 122 void __cabi_abort( const char fmt[], ... ) __attribute__ 125 void __cabi_abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) { 123 126 va_list argp; 124 127 va_start( argp, fmt ); … … 127 130 } 128 131 129 void exit( int status ) __attribute__ 132 void exit( int status ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) { 130 133 __cabi_libc.exit( status ); 131 134 } 132 135 } 133 136 134 void * kernel_abort ( void ) __attribute__ 135 void kernel_abort_msg( void * data, char * buffer, int size ) __attribute__ 136 int kernel_abort_lastframe( void ) __attribute__ 137 void * kernel_abort ( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return NULL; } 138 void kernel_abort_msg( void * data, char * buffer, int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {} 139 int kernel_abort_lastframe( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 4; } 137 140 138 141 enum { abort_text_size = 1024 }; … … 140 143 static int abort_lastframe; 141 144 142 void exit( int status, const char fmt[], ... ) __attribute__ 145 void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )) { 143 146 va_list args; 144 147 va_start( args, fmt ); … … 148 151 } 149 152 150 void abort( const char fmt[], ... ) __attribute__ 153 void abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) { 151 154 void * kernel_data = kernel_abort(); // must be done here to lock down kernel 152 155 int len; -
src/libcfa/time.c
r43c461d rd7312ac 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 12 14:41:00201813 // Update Count : 2212 // Last Modified On : Sat May 5 09:04:51 2018 13 // Update Count : 36 14 14 // 15 15 … … 17 17 #include "iostream" 18 18 #include <stdio.h> // snprintf 19 #include <assert.h> 19 20 20 21 static char * nanomsd( long int ns, char * buf ) { // most significant digits … … 87 88 time_t s = tv / TIMEGRAN; 88 89 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" 90 93 snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_year % 99, tm.tm_mon + 1, tm.tm_mday ); 94 #pragma GCC diagnostic pop 91 95 return buf; 92 96 } // yy_mm_dd … … 95 99 time_t s = tv / TIMEGRAN; 96 100 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" 98 104 snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mon + 1, tm.tm_mday, tm.tm_year % 99 ); 105 #pragma GCC diagnostic pop 99 106 return buf; 100 107 } // mm_dd_yy … … 103 110 time_t s = tv / TIMEGRAN; 104 111 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" 106 115 snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year % 99 ); 116 #pragma GCC diagnostic pop 107 117 return buf; 108 118 } // dd_mm_yy
Note: See TracChangeset
for help on using the changeset viewer.