2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* error.h */
|
2000-05-28 13:40:48 +00:00
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Error handling for the cc65 C compiler */
|
2000-05-28 13:40:48 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
2011-05-01 17:42:49 +00:00
|
|
|
/* (C) 1998-2011, Ullrich von Bassewitz */
|
2009-10-08 13:29:35 +00:00
|
|
|
/* Roemerstrasse 52 */
|
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-05-28 13:40:48 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ERROR_H
|
|
|
|
#define ERROR_H
|
|
|
|
|
|
|
|
|
2000-09-14 19:26:13 +00:00
|
|
|
|
2011-05-01 17:42:49 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2000-08-19 21:55:06 +00:00
|
|
|
/* common */
|
|
|
|
#include "attrib.h"
|
2009-10-08 13:29:35 +00:00
|
|
|
#include "intstack.h"
|
2000-08-19 21:55:06 +00:00
|
|
|
|
2009-03-08 14:54:53 +00:00
|
|
|
/* cc65 */
|
|
|
|
#include "lineinfo.h"
|
|
|
|
|
2000-08-19 21:55:06 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Data */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Count of errors/warnings */
|
|
|
|
extern unsigned ErrorCount;
|
|
|
|
extern unsigned WarningCount;
|
|
|
|
|
2009-10-08 13:29:35 +00:00
|
|
|
/* Warning and error options */
|
|
|
|
extern IntStack WarnEnable; /* Enable warnings */
|
|
|
|
extern IntStack WarningsAreErrors; /* Treat warnings as errors */
|
2010-10-02 19:32:11 +00:00
|
|
|
/* Warn about: */
|
2010-11-28 21:16:46 +00:00
|
|
|
extern IntStack WarnConstComparison; /* - constant comparison results */
|
2021-03-25 05:32:46 +00:00
|
|
|
extern IntStack WarnPointerSign; /* - pointer conversion to pointer differing in signedness */
|
|
|
|
extern IntStack WarnPointerTypes; /* - pointer conversion to incompatible pointer type */
|
2010-11-28 21:16:46 +00:00
|
|
|
extern IntStack WarnNoEffect; /* - statements without an effect */
|
2016-06-11 10:43:19 +00:00
|
|
|
extern IntStack WarnRemapZero; /* - remapping character code zero */
|
2021-04-12 15:05:31 +00:00
|
|
|
extern IntStack WarnReturnType; /* - control reaches end of non-void function */
|
2010-11-28 21:16:46 +00:00
|
|
|
extern IntStack WarnStructParam; /* - structs passed by val */
|
2016-06-11 10:43:19 +00:00
|
|
|
extern IntStack WarnUnknownPragma; /* - unknown #pragmas */
|
2021-04-12 15:05:31 +00:00
|
|
|
extern IntStack WarnUnreachableCode; /* - unreachable code */
|
2010-11-28 21:16:46 +00:00
|
|
|
extern IntStack WarnUnusedLabel; /* - unused labels */
|
|
|
|
extern IntStack WarnUnusedParam; /* - unused parameters */
|
|
|
|
extern IntStack WarnUnusedVar; /* - unused variables */
|
2021-05-07 16:38:26 +00:00
|
|
|
extern IntStack WarnUnusedFunc; /* - unused functions */
|
2009-10-08 13:29:35 +00:00
|
|
|
|
2020-08-02 13:51:32 +00:00
|
|
|
/* Forward */
|
|
|
|
struct StrBuf;
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* code */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-08 13:29:35 +00:00
|
|
|
void Fatal (const char* Format, ...) attribute ((noreturn, format (printf, 1, 2)));
|
|
|
|
/* Print a message about a fatal error and die */
|
2009-03-08 14:54:53 +00:00
|
|
|
|
2009-10-08 13:29:35 +00:00
|
|
|
void Internal (const char* Format, ...) attribute ((noreturn, format (printf, 1, 2)));
|
|
|
|
/* Print a message about an internal compiler error and die. */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-11-02 21:22:33 +00:00
|
|
|
void Error (const char* Format, ...) attribute ((format (printf, 1, 2)));
|
2000-10-15 19:52:01 +00:00
|
|
|
/* Print an error message */
|
|
|
|
|
2009-03-08 14:54:53 +00:00
|
|
|
void LIError (const LineInfo* LI, const char* Format, ...) attribute ((format (printf, 2, 3)));
|
|
|
|
/* Print an error message with the line info given explicitly */
|
|
|
|
|
2000-10-15 19:52:01 +00:00
|
|
|
void PPError (const char* Format, ...) attribute ((format (printf, 1, 2)));
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Print an error message. For use within the preprocessor. */
|
|
|
|
|
2009-10-08 13:29:35 +00:00
|
|
|
void Warning (const char* Format, ...) attribute ((format (printf, 1, 2)));
|
|
|
|
/* Print warning message. */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2009-10-08 13:29:35 +00:00
|
|
|
void LIWarning (const LineInfo* LI, const char* Format, ...) attribute ((format (printf, 2, 3)));
|
|
|
|
/* Print a warning message with the line info given explicitly */
|
|
|
|
|
|
|
|
void PPWarning (const char* Format, ...) attribute ((format (printf, 1, 2)));
|
|
|
|
/* Print warning message. For use within the preprocessor. */
|
|
|
|
|
|
|
|
IntStack* FindWarning (const char* Name);
|
|
|
|
/* Search for a warning in the WarnMap table and return a pointer to the
|
2014-06-30 09:10:35 +00:00
|
|
|
** intstack that holds its state. Return NULL if there is no such warning.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2011-05-01 17:42:49 +00:00
|
|
|
void ListWarnings (FILE* F);
|
|
|
|
/* Print a list of warning types/names to the given file */
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
void ErrorReport (void);
|
|
|
|
/* Report errors (called at end of compile) */
|
|
|
|
|
2020-08-02 13:51:32 +00:00
|
|
|
void InitDiagnosticStrBufs (void);
|
|
|
|
/* Init tracking string buffers used for diagnostics */
|
|
|
|
|
|
|
|
void DoneDiagnosticStrBufs (void);
|
|
|
|
/* Done with tracked string buffers used for diagnostics */
|
|
|
|
|
|
|
|
void ClearDiagnosticStrBufs (void);
|
|
|
|
/* Free all tracked string buffers */
|
|
|
|
|
|
|
|
struct StrBuf* NewDiagnosticStrBuf (void);
|
|
|
|
/* Get a new tracked string buffer */
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* End of error.h */
|
|
|
|
|
2014-03-04 00:11:19 +00:00
|
|
|
#endif
|