Diagnostics

Every diagnostic badc prints ends with its code and its name:

unit.c:3: warning: unused variable `x` [B2001] [-Wunused-variable]
unit.c:7: error: `)` expected after cast [B2020] [syntax]

The code and the name are stable: each stays with the diagnostic it was assigned, and a code is not renumbered. Either selects the row wherever a selector is accepted:

A hard row is always an error: its site has no way to continue, and no option changes it. A note is advisory. The default level and the groups may change between releases; the code and the name do not.

This file is generated by scripts/diagnostics_doc.py from tests/diagnostics/catalog.txt, which badc --list-diagnostics regenerates.

code name default class groups description
B1001 unknown-directive warning controllable default a # line naming no directive badc implements; the line is dropped
B1002 #warnings warning controllable default a #warning directive reached in an active conditional block
B1003 malformed-directive warning controllable default a macro-expanded #include or #line operand that does not reparse
B1004 unknown-pragmas warning controllable default,all a #pragma badc does not implement; the directive is ignored
B1005 pragma-syntax warning controllable default a diagnostic pragma badc implements whose operand is malformed
B1006 pragma-pop-without-push warning controllable default a diagnostic-pragma pop with no matching push
B1007 ignored-pragma-intrinsic warning controllable default a #pragma intrinsic naming a function badc has no intrinsic for; the name stays an ordinary call
B1010 directive error hard - a directive whose operand the preprocessor cannot process, or a conditional directive with no #if to match
B1011 invalid-pragma error hard - a pragma badc implements whose operand cannot be applied
B1012 invalid-token error hard - a character sequence that forms no token: a malformed constant, escape sequence or universal character name
B1013 error-directive error hard - a #error directive reached in an active conditional block
B1014 macro error hard - a macro definition or invocation C99 6.10.3 rejects: an argument count the definition does not take, ## at either end of a replacement list
B2001 unused-variable ignore controllable all a variable declared and never used
B2002 unused-parameter ignore controllable extra a parameter never used in the function body
B2003 unused-but-set-variable ignore controllable all a variable that is only ever assigned to
B2004 unused-function ignore controllable all a function with internal linkage that is defined and never referenced
B2005 implicit-function-declaration warning controllable default a function used before a prototype declares it, so its return type is int
B2006 undefined-function warning controllable default an initializer names a static function this unit declares and never defines
B2007 redeclaration-mismatch warning controllable default a redeclaration whose signature differs from the previous one
B2008 attributes warning controllable default an attribute the declaration cannot carry, so it is ignored
B2009 ignored-asm-label warning controllable default an assembler name on a declaration that has no symbol to rename
B2010 shadowed-binding warning controllable default a #pragma binding for a name an earlier binding already claimed
B2020 syntax error hard - a token the grammar does not admit at its position; the parser has no resynchronisation point
B2021 invalid-declaration error hard - a declaration a C99 constraint rejects: a redefinition, conflicting types, an incomplete object, a bit-field width or an alignment out of range
B2022 undeclared-identifier error hard - a name no declaration in scope introduces
B2023 static-assert error hard - a static assertion whose controlling expression is zero
B3001 int-conversion warning controllable default an integer and a pointer exchanged with no cast
B3002 incompatible-struct-types warning controllable default an aggregate used where a different aggregate type is expected
B3003 return-type ignore controllable all control reaches the end of a value-returning function
B3004 too-few-arguments warning controllable default a call passing fewer arguments than the prototype declares
B3005 too-many-arguments warning controllable default a call passing more arguments than the prototype declares
B3006 long-double-abi warning controllable default a long double argument passed in a format this target’s ABI does not use
B3007 dead-store ignore controllable - a value assigned to a local and replaced before any read
B3020 invalid-operands error hard - an operator applied to operands its constraints reject, or a non-lvalue where an lvalue is required
B3021 constant-expression error hard - an expression that must be constant and is not, or one the compiler cannot evaluate at translation time
B3022 invalid-initializer error hard - an initializer C99 6.7.8 rejects: a mismatched brace form, a designator naming nothing, an index out of range
B3023 invalid-arguments error hard - a builtin or intrinsic called with arguments it does not take
B3024 invalid-statement error hard - a statement outside the construct it needs: break outside a loop, case outside a switch, a goto to no label
B3025 incompatible-types error hard - a value of a type no implicit conversion takes to the type required: an aggregate assigned, passed or returned as another
B3026 return-mismatch error controllable default a return with a value in a function returning void, or with none in a function returning a value
B3027 void-value error hard - the value of a void expression used: as an operand, an argument, an initializer, an assigned or returned value, or a controlling expression
B3028 controlling-expression error hard - a controlling expression of a type its statement does not take: a non-scalar if, while, do or for condition, a non-integer switch expression
B4001 unsupported error hard - a well-formed construct badc does not implement
B4002 limit error hard - a translation limit badc imposes: nesting depth, include depth, alignment
B4003 inline ignore controllable - a function the source declared inline that the optimizer left out of line
B4004 always-inline warning controllable default a function marked always_inline or __forceinline that the optimizer left out of line
B4005 frame-larger-than warning controllable default a function whose stack frame exceeds the -Wframe-larger-than= bound; saved registers and the frame record count, alloca and variable-length arrays do not
B5001 asm-syntax error hard - an asm statement whose operand list, constraints or template does not parse
B5002 assembler error hard - an instruction or directive the assembler cannot parse or encode for the target
B6001 orphan-section warning controllable default an input section no script rule names, placed by the linker’s own rule
B6002 missing-entry warning controllable default no input defines the entry symbol, so the image enters at the first text address
B6003 merged-section-access warning controllable default a relocation reaches past the end of the merged section it names
B6010 undefined-symbol error hard - a reference no input object, archive or shared library defines
B6011 duplicate-symbol error hard - more than one input defines the same symbol
B6012 relocation error hard - a relocation the linker cannot apply, or a value its field cannot hold
B6013 linker-script error hard - a linker script badc cannot parse, or a construct it does not implement
B6014 malformed-input error hard - an input object, archive or shared library the reader cannot make sense of
B6015 object-format error hard - a construct the selected object format cannot express
B6016 link error hard - a link-time failure with no more specific row
B7001 unknown-argument error hard - command-line option or operand the driver does not implement
B7002 unknown-warning-option warning controllable default a diagnostic pragma names a selector that is not in the catalogue
B7003 unused-command-line-argument ignore controllable all,extra an accepted option that selects nothing in the mode the command line picked
B7004 no-input-files error hard - the command line names nothing to compile, assemble or link
B7005 input-unreadable error hard - an input file the driver cannot read
B7006 output-unwritable error hard - the driver cannot write the file it was asked to produce
B7007 unsupported-option error controllable default an option badc parses but declines in the mode the command line picked
B7008 link-pragma-ignored warning controllable default a link request from a source pragma that an object file does not carry
B7009 cross-target-output warning note - the image is for another host and will not run where it was built
B7010 freestanding-import warning controllable default a freestanding image binds a shared-library symbol, so it runs through the dynamic loader
B7011 dwarf-output warning controllable default a -gdwarf option asks for a DWARF version or format the emitter does not produce
B9001 internal-error error hard - an invariant inside badc did not hold

^ To the top