/* ----------------------------------------------------------------------- * * * Copyright 1996-2019 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following * conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ----------------------------------------------------------------------- */ /* * error.c - error message handling routines for the assembler */ #include "compiler.h" #include "nasmlib.h" #include "error.h" /* Common function body */ #define nasm_do_error(_sev,_flags) … void nasm_error(errflags severity, const char *fmt, ...) { … } #define nasm_err_helpers(_type, _name, _sev) … nasm_err_helpers(…) nasm_err_helpers(…) nasm_err_helpers(…) nasm_err_helpers(…) nasm_err_helpers(…) nasm_err_helpers(…) nasm_err_helpers(…) /* * Strongly discourage warnings without level by require flags on warnings. * This means nasm_warn() is the equivalent of the -f variants of the * other ones. */ void nasm_warn(errflags flags, const char *fmt, ...) { … } fatal_func nasm_panic_from_macro(const char *file, int line) { … } fatal_func nasm_assert_failed(const char *file, int line, const char *msg) { … } /* * Warning stack management. Note that there is an implicit "push" * after the command line has been parsed, but this particular push * cannot be popped. */ struct warning_stack { … }; static struct warning_stack *warning_stack, *warning_state_init; /* Push the warning status onto the warning stack */ void push_warnings(void) { … } /* Pop the warning status off the warning stack */ void pop_warnings(void) { … } /* Call after the command line is parsed, but before the first pass */ void init_warnings(void) { … } /* Call after each pass */ void reset_warnings(void) { … } /* * This is called when processing a -w or -W option, or a warning directive. * Returns on if if the action was successful. * * Special pseudo-warnings: * *!other [on] any warning not specifially mentioned above *! specifies any warning not included in any specific warning class. * *!all [all] all possible warnings *! is an group alias for \e{all} warning classes. Thus, \c{-w+all} *! enables all available warnings, and \c{-w-all} disables warnings *! entirely (since NASM 2.13). */ bool set_warning_status(const char *value) { … }