RRichard Russonbugprone: parenthesize macro arguments/replacement lists
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
refactor: upgrade macro flags to enum flags Turn #define'd flags into enums. Enums provide: - debugger visibility - compiler diagnostics - symbol scoping by convention - easier navigation/search - cleaner documentation generation - type grouping Naming: - enum has singular ending, e.g. Flag - typedef wrapper has plural ending, e.g. Flags Suffix `_NO_FLAGS` has been renamed to `_NONE` for consistency. | 4 个月前 | |
iwyu: fix includes | 6 个月前 | |
relocate config options Move 65 config items and their data out of mutt_config.c | 7 个月前 | |
menu: fold 'dialog' back into 'generic' Fold the short-lived 'dialog' menu functions back into the 'generic' menu. | 3 个月前 | |
initialise things Ensure that pointers, structs and variables used as outparams are initialised. (some of variable types were obscured by typedefs) | 2 个月前 | |
expando: rename RenderData to RenderCallback The struct doesn't contain any data, just callback functions. | 1 年前 | |
expando: rename RenderData to RenderCallback The struct doesn't contain any data, just callback functions. | 1 年前 | |
docs: fix ~L pattern description | 5 个月前 | |
doxy: function callbacks If dispatcher callback function handles multiple opcodes, document it. | 4 个月前 | |
add more data to function dispatchers | 4 个月前 | |
refactor: upgrade macro flags to enum flags Turn #define'd flags into enums. Enums provide: - debugger visibility - compiler diagnostics - symbol scoping by convention - easier navigation/search - cleaner documentation generation - type grouping Naming: - enum has singular ending, e.g. Flag - typedef wrapper has plural ending, e.g. Flags Suffix `_NO_FLAGS` has been renamed to `_NONE` for consistency. | 4 个月前 | |
pattern: move globals to PatternModuleData - Add range_regexes[] to struct PatternModuleData - Initialize array in pattern_init() - Free compiled regexes in pattern_cleanup() - Update pattern.c and message.c to use mod_data - Remove extern from private.h | 4 个月前 | |
module: tidy cleanup Pass the Module Data to the Module on cleanup() | 4 个月前 | |
module: add Notify object to each globals Add a 'struct Notify *notify' member to every ModuleData struct. Create it with notify_new() in each Module.init() function, set its parent to NeoMutt->notify, and free it in Module.cleanup(). For modules that previously had commented-out init/cleanup code, uncomment the mod_data allocation and deallocation. | 4 个月前 | |
pattern: move globals to PatternModuleData - Add range_regexes[] to struct PatternModuleData - Initialize array in pattern_init() - Free compiled regexes in pattern_cleanup() - Update pattern.c and message.c to use mod_data - Remove extern from private.h | 4 个月前 | |
pattern: unify Menu data | 1 年前 | |
pattern: unify Menu data | 1 年前 | |
bugprone: parenthesize macro arguments/replacement lists The last of the three categories flatcap flagged as good candidates on #4970 -- bugprone-macro-parentheses. 28 sites across 13 files fixed; 7 confirmed as genuine false positives and deliberately left untouched (see below). Every site was checked against its actual call sites for a live bug, not just mechanically wrapped: - Simple negative-constant macros (COLOR_DEFAULT, MUTT_WIN_SIZE_UNLIMITED, OP_REPAINT/TIMEOUT/ABORT, IMAP_RES_NO/BAD, MUTT_MAXRANGE) get their replacement list wrapped. - Value-expression arguments used unparenthesized next to an operator (config/types.h's IS_MAILBOX/IS_COMMAND, mutt/array.h's ARRAY_GET, mutt/mbyte.h's IsWPrint/IsBOM, notmuch/private.h's LIBNOTMUCH_CHECK_VERSION) get the argument wrapped -- no live caller currently passes a compound expression, but this is exactly the class of bug that bites the next caller who does. - mutt/string2.h's SKIPWS and mutt/array.h's ARRAY_FOREACH_(REVERSE_)FROM_TO wrap the argument even though it's used as an assignment/increment target, since `(x)++`/`(x) = ...` are equivalent to the unparenthesized form for any valid lvalue -- harmless, satisfies the check. Three false-positive patterns confirmed and left alone, since parenthesizing would either not compile or change meaning: - mutt/atoi.h:39 and mutt/memory.h:57: the macro argument is a type name (a function parameter's type, and a _Generic type-association respectively), not a value expression -- wrapping a type name in parens isn't valid there. - mutt/array.h:52: same class -- `T` is the array element's type name in a struct member declaration. - mutt/queue.h:437/632/887/896 (all four remaining sites in that file): `field` is passed as a member-designator into `__containerof()` (built on `offsetof()`), not a value expression. Verified empirically with a standalone test file: parenthesizing a member-designator argument to `offsetof()` is a genuine compile error ("expected identifier"), not just a style question. Verification: `clang-tidy -p . <file> --checks='-*,bugprone-macro-parentheses' --header-filter='.*'` now reports only the 7 confirmed-false-positive sites above (was 28 fixable + 7 false positives = 35 total unique locations). Full clean build, `make test` passes (all suites), `clang-format --dry-run -Werror` shows no *new* violations in any changed file (checked differentially against each file's pre-existing state, since several of these headers already had unrelated formatting drift). AI assistance: the mechanical location of all sites, the call-site tracing to distinguish live risk from defensive-only fixes, and the identification + empirical verification of the false positives was done by Claude Code; I reviewed the reasoning and diff, including the compile-error test for the offsetof() case, before this went up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> | 1 个月前 | |
Use MUTT_MEM_CALLOC() Reviewed-by: Pietro Cerutti <gahr@gahr.ch> Signed-off-by: Alejandro Colomar <alx@kernel.org> | 1 年前 | |
refactor: upgrade macro flags to enum flags Turn #define'd flags into enums. Enums provide: - debugger visibility - compiler diagnostics - symbol scoping by convention - easier navigation/search - cleaner documentation generation - type grouping Naming: - enum has singular ending, e.g. Flag - typedef wrapper has plural ending, e.g. Flags Suffix `_NO_FLAGS` has been renamed to `_NONE` for consistency. | 4 个月前 |