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