Changes in src/Common/SemanticError.h [4358c1e:9dc31c10]
- File:
-
- 1 edited
-
src/Common/SemanticError.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.h
r4358c1e r9dc31c10 7 7 // SemanticError.h -- 8 8 // 9 // Author : Thierry Delisle9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 16 15:01:23201813 // Update Count : 3012 // Last Modified On : Wed Apr 18 16:28:16 2018 13 // Update Count : 18 14 14 // 15 15 … … 17 17 18 18 #include "ErrorObjects.h" 19 #include <cstring>20 19 21 20 //----------------------------------------------------------------------------- 22 21 // Errors 23 24 extern bool SemanticErrorThrow;25 22 26 23 __attribute__((noreturn)) void SemanticError( CodeLocation location, std::string error ); … … 39 36 // Warnings 40 37 41 enum class Severity { 42 Suppress, 43 Warn, 44 Error, 45 Critical 46 }; 47 48 struct WarningData { 49 const char * const name; 50 const char * const message; 51 const Severity default_severity; 52 }; 53 54 constexpr WarningData WarningFormats[] = { 55 {"self-assign" , "self assignment of expression: %s" , Severity::Warn}, 56 {"reference-conversion" , "rvalue to reference conversion of rvalue: %s" , Severity::Warn}, 57 {"qualifiers-zero_t-one_t", "questionable use of type qualifier %s with %s", Severity::Warn}, 38 constexpr const char * const WarningFormats[] = { 39 "self assignment of expression: %s", 40 "rvalue to reference conversion of rvalue: %s", 41 "questionable use of type qualifier %s with %s", 58 42 }; 59 43 … … 70 54 ); 71 55 72 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, __VA_ARGS__) 56 // ## used here to allow empty __VA_ARGS__ 57 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], ## __VA_ARGS__) 73 58 74 59 void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4))); 75 60 76 void SemanticWarning_SuppressAll ();77 void SemanticWarning_EnableAll ();78 void SemanticWarning_WarningAsError();79 void SemanticWarning_Set (const char * const name, Severity s);80 81 // SKULLDUGGERY: cfa.cc is built before SemanticError.cc but needs this routine.82 static inline bool SemanticWarning_Exist(const char * const name) {83 for ( const auto & w : WarningFormats ) {84 if ( std::strcmp( name, w.name ) == 0 ) return true;85 }86 return false;87 }88 61 89 62 //-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.