- Timestamp:
- Apr 19, 2018, 11:04:47 AM (7 years ago)
- 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:
- c28bcc7
- Parents:
- b2da0574 (diff), 61323a7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.cc
rb2da0574 r2ae16219 68 68 } 69 69 70 void SemanticWarningImpl( CodeLocation location, Warning, const char * const fmt, ... ) { 71 va_list args; 72 va_start(args, fmt); 73 std::string msg = fmtToString( fmt, args ); 74 va_end(args); 75 std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl; 70 void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) { 71 Severity severity = WarningFormats[(int)warning].severity; 72 switch(severity) { 73 case Severity::Suppress : 74 break; 75 case Severity::Warn : 76 { 77 va_list args; 78 va_start(args, fmt); 79 std::string msg = fmtToString( fmt, args ); 80 va_end(args); 81 std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl; 82 } 83 break; 84 case Severity::Error : 85 { 86 va_list args; 87 va_start(args, fmt); 88 std::string msg = fmtToString( fmt, args ); 89 va_end(args); 90 SemanticError(location, msg); 91 } 92 break; 93 case Severity::Critical : 94 assertf(false, "Critical errors not implemented yet"); 95 break; 96 } 76 97 } 77 98 -
src/Common/SemanticError.h
rb2da0574 r2ae16219 36 36 // Warnings 37 37 38 constexpr const char * const WarningFormats[] = { 39 "self assignment of expression: %s", 40 "rvalue to reference conversion of rvalue: %s", 38 enum class Severity { 39 Suppress, 40 Warn, 41 Error, 42 Critical 43 }; 44 45 struct WarningData { 46 const char * const name; 47 const char * const message; 48 mutable Severity severity; 49 }; 50 51 constexpr const WarningData WarningFormats[] = { 52 {"self-assign" , "self assignment of expression: %s" , Severity::Warn}, 53 {"reference-conversion", "rvalue to reference conversion of rvalue: %s", Severity::Warn}, 41 54 }; 42 55 … … 52 65 ); 53 66 54 // ## used here to allow empty __VA_ARGS__ 55 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], ## __VA_ARGS__) 67 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, __VA_ARGS__) 56 68 57 69 void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4))); -
src/Parser/parser.yy
rb2da0574 r2ae16219 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 28 17:52:24201813 // Update Count : 31 3012 // Last Modified On : Tue Apr 17 17:10:30 2018 13 // Update Count : 3144 14 14 // 15 15 … … 391 391 %precedence '(' 392 392 393 %locations // support location tracking for error messages393 %locations // support location tracking for error messages 394 394 395 395 %start translation_unit // parse-tree root … … 1708 1708 | LONG 1709 1709 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); } 1710 | ZERO_T1711 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }1712 | ONE_T1713 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }1714 1710 | VALIST // GCC, __builtin_va_list 1715 1711 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } … … 1731 1727 basic_type_specifier: 1732 1728 direct_type 1729 // Cannot have type modifiers, e.g., short, long, etc. 1733 1730 | type_qualifier_list_opt indirect_type type_qualifier_list_opt 1734 1731 { $$ = $2->addQualifiers( $1 )->addQualifiers( $3 ); } … … 1736 1733 1737 1734 direct_type: 1738 // A semantic check is necessary for conflicting type qualifiers.1739 1735 basic_type_name 1740 1736 | type_qualifier_list basic_type_name … … 1755 1751 | ATTR_TYPEGENname '(' comma_expression ')' // CFA: e.g., @type(a+b) y; 1756 1752 { $$ = DeclarationNode::newAttr( $1, $3 ); } 1753 | ZERO_T // CFA 1754 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); } 1755 | ONE_T // CFA 1756 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); } 1757 1757 ; 1758 1758 -
src/libcfa/time
rb2da0574 r2ae16219 10 10 // Created On : Wed Mar 14 23:18:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 13 07:51:52201813 // Update Count : 63 412 // Last Modified On : Sat Apr 14 17:48:23 2018 13 // Update Count : 636 14 14 // 15 15 … … 29 29 30 30 //######################### Duration ######################### 31 32 static inline void ?{}( Duration & dur, Duration d ) with( dur ) { tv = d.tv; }33 31 34 32 static inline Duration ?=?( Duration & dur, zero_t ) { return dur{ 0 }; } … … 137 135 //######################### Time ######################### 138 136 139 static inline void ?{}( Time & time, Time t ) with( time ) { tv = t.tv; }140 137 void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 ); 138 static inline Time ?=?( Time & time, zero_t ) { return time{ 0 }; } 139 141 140 static inline void ?{}( Time & time, timeval t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; } 142 143 static inline Time ?=?( Time & time, zero_t ) { return time{ 0 }; }144 145 141 static inline Time ?=?( Time & time, timeval t ) with( time ) { 146 142 tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); … … 148 144 } // ?=? 149 145 150 static inline void ?{}( Time & time, timespec t ) with( time ) { 151 tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; 152 } // Time 153 146 static inline void ?{}( Time & time, timespec t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 154 147 static inline Time ?=?( Time & time, timespec t ) with( time ) { 155 148 tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; -
src/tests/concurrent/preempt.c
rb2da0574 r2ae16219 11 11 } 12 12 13 #ifdef LONG_TEST 14 static const unsigned long N = 30_000ul; 15 #else 16 static const unsigned long N = 500ul; 17 #endif 18 13 19 static volatile int counter = 0; 14 20 … … 22 28 23 29 void main(worker_t & this) { 24 while(counter < 1000) {30 while(counter < N) { 25 31 if( (counter % 7) == this.value ) { 26 32 int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
Note:
See TracChangeset
for help on using the changeset viewer.