Changes in src/Common/SemanticError.h [be00a2d:610354a]
- File:
-
- 1 edited
-
src/Common/SemanticError.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.h
rbe00a2d r610354a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 25 12:01:31202313 // Update Count : 3712 // Last Modified On : Thu Dec 14 13:48:07 2023 13 // Update Count : 72 14 14 // 15 15 … … 18 18 #include "ErrorObjects.h" 19 19 #include "AST/Node.hpp" 20 #include "AST/ParseNode.hpp" 20 21 #include <cstring> 21 22 … … 25 26 extern bool SemanticErrorThrow; 26 27 27 __attribute__((noreturn )) void SemanticError( CodeLocation location, std::string error);28 __attribute__((noreturn, format(printf, 2, 3))) void SemanticError( CodeLocation location, const char fmt[], ... ); 28 29 29 template< typename T > 30 __attribute__((noreturn)) static inline void SemanticError( const T * obj, const std::string & error ) { 30 __attribute__((noreturn)) static inline void SemanticError( CodeLocation location, std::string error ) { 31 SemanticErrorThrow = true; 32 throw SemanticErrorException( location, error ); 33 } 34 35 __attribute__((noreturn)) static inline void SemanticError( const ast::ParseNode * obj, const std::string & error ) { 31 36 SemanticError( obj->location, toString( error, obj ) ); 32 37 } 33 38 34 template< typename T > 35 __attribute__((noreturn)) static inline void SemanticError( CodeLocation location, const T * obj, const std::string & error ) { 39 __attribute__((noreturn)) static inline void SemanticError( CodeLocation location, const ast::Node * obj, const std::string & error ) { 36 40 SemanticError( location, toString( error, obj ) ); 37 41 } … … 54 58 55 59 constexpr WarningData WarningFormats[] = { 56 {"self-assign" , Severity::Warn , "self assignment of expression: %s" },57 {"reference-conversion" , Severity::Warn , "rvalue to reference conversion of rvalue: %s" },58 {"qualifiers-zero_t-one_t" , Severity::Warn , "questionable use of type qualifier(s) with %s" },59 {"aggregate-forward-decl" , Severity::Warn , "forward declaration of nested aggregate: %s" },60 {"superfluous-decl" , Severity::Warn , "declaration does not allocate storage: %s" },61 {"superfluous-else" , Severity::Warn , "else clause never executed for empty loop conditional" },62 {"gcc-attributes" , Severity::Warn , "invalid attribute: %s" },63 {"c++-like-copy" , Severity::Warn , "Constructor from reference is not a valid copy constructor" },64 {"depreciated-trait-syntax" , Severity::Warn , "trait type-parameters are now specified using the forall clause" },60 {"self-assign" , Severity::Warn, "self assignment of expression: %s" }, 61 {"reference-conversion" , Severity::Warn, "rvalue to reference conversion of rvalue: %s" }, 62 {"qualifiers-zero_t-one_t" , Severity::Warn, "questionable use of type qualifier(s) with %s" }, 63 {"aggregate-forward-decl" , Severity::Warn, "forward declaration of nested aggregate: %s" }, 64 {"superfluous-decl" , Severity::Warn, "declaration does not allocate storage: %s" }, 65 {"superfluous-else" , Severity::Warn, "else clause never executed for empty loop conditional" }, 66 {"gcc-attributes" , Severity::Warn, "invalid attribute: %s" }, 67 {"c++-like-copy" , Severity::Warn, "Constructor from reference is not a valid copy constructor" }, 68 {"depreciated-trait-syntax" , Severity::Warn, "trait type-parameters are now specified using the forall clause" }, 65 69 }; 66 70 … … 75 79 CppCopy, 76 80 DeprecTraitSyntax, 77 NUMBER_OF_WARNINGS, // This MUST be the last warning81 NUMBER_OF_WARNINGS, // MUST be last warning 78 82 }; 79 83 … … 83 87 ); 84 88 85 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, ##__VA_ARGS__) 89 void SemanticWarning( CodeLocation loc, Warning warn, ... ); 86 90 87 void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4))); 88 89 void SemanticWarning_SuppressAll (); 90 void SemanticWarning_EnableAll (); 91 void SemanticWarning_SuppressAll(); 92 void SemanticWarning_EnableAll(); 91 93 void SemanticWarning_WarningAsError(); 92 void SemanticWarning_Set (const char * const name, Severity s);94 void SemanticWarning_Set(const char * const name, Severity s); 93 95 94 96 // SKULLDUGGERY: cfa.cc is built before SemanticError.cc but needs this routine.
Note:
See TracChangeset
for help on using the changeset viewer.