X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=diagnostic.h;h=113481c28353a1e7dbc5b0ffd00e7e88ae68944f;hb=d9e14443ff584032ca378ba617a2917d4e4e3b26;hp=5e8e0aa302f617a0e13e1bea81716beca6cf52e3;hpb=f3f57226195059ecb38d482c469a4c665fc9c2d1;p=cparser diff --git a/diagnostic.h b/diagnostic.h index 5e8e0aa..113481c 100644 --- a/diagnostic.h +++ b/diagnostic.h @@ -1,6 +1,6 @@ /* * This file is part of cparser. - * Copyright (C) 2007-2008 Matthias Braun + * Copyright (C) 2007-2009 Matthias Braun * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,15 +23,43 @@ #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 * + * %S const string_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; extern unsigned warning_count; -/* true if warnings should be inhibited */ -extern bool inhibit_all_warnings; - #endif