X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=diagnostic.h;h=663e6dc944edc97d58b3a8ebcff2d9c86139dcb3;hb=d448b9e4c6893c79eb5f712652a8f3b1626a101a;hp=ae54d24d5610ffa75533c80157209b8a9b371908;hpb=fd16b92f058181088a385c3224c8814831c006d3;p=cparser diff --git a/diagnostic.h b/diagnostic.h index ae54d24..663e6dc 100644 --- a/diagnostic.h +++ b/diagnostic.h @@ -20,11 +20,43 @@ #ifndef DIAGNOSTIC_H #define DIAGNOSTIC_H +#include #include "token_t.h" +/* define a NORETURN attribute */ +#ifndef NORETURN +# if defined(__GNUC__) +# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70) +# define NORETURN void __attribute__ ((noreturn)) +# endif /* __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70) */ +# endif /* defined(__GNUC__) */ + +# if defined(_MSC_VER) +# define NORETURN void __declspec(noreturn) +# endif /* defined(_MSC_VER) */ + +/* If not set above, use "void" for DOES_NOT_RETURN. */ +# ifndef NORETURN +# define NORETURN void +# endif /* ifndef NORETURN */ +#endif /* ifndef NORETURN */ + +/** + * Issue a diagnostic message. + * Format types: + * %Y const symbol_t * + * %E const expression_t * + * %Q unsigned (qualifier) + * %T const type_t* + * %K const token_t* + * %k token_kind_t + * %P const source_position_t * + * + */ void diagnosticf(const char *fmt, ...); -void errorf(source_position_t pos, const char *fmt, ...); -void warningf(source_position_t pos, const char *fmt, ...); +void errorf(const source_position_t *pos, const char *fmt, ...); +void warningf(const source_position_t *pos, const char *fmt, ...); +NORETURN internal_errorf(const source_position_t *pos, const char *fmt, ...); extern unsigned diagnostic_count; extern unsigned error_count;