mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-18 13:22:56 +02:00
This commit performs a broad modernization of widely used rsyslog macros to align with modern C practices and support automated formatting tools like clang-format. The changes focus on improving syntactic regularity, readability, and tooling compatibility — without altering behavior. Macros refactored in this commit now follow a consistent, statement-like form with explicit trailing semicolons. Where applicable, macro blocks that define module interfaces (`queryEtryPt`) have been updated to use simple `if` statements instead of `else if` chains. While this slightly increases evaluation time, the affected functions are only called once per module during load time to register supported interfaces — making the performance cost irrelevant in practice. These improvements serve multiple purposes: - Enable reliable clang-format usage without mangling macro logic - Simplify reasoning about macro-expanded code for human readers - Reduce style drift and merge conflicts - Facilitate development for contributors using assistive tools - Support future formatting pipelines using: 1. `clang-format` 2. a post-fixup normalization script Refactored macros: - MODULE_TYPE_NOKEEP - MODULE_TYPE_KEEP - MODULE_TYPE_INPUT - MODULE_TYPE_OUTPUT - MODULE_TYPE_FUNCTION - MODULE_TYPE_PARSER - MODULE_TYPE_LIB - DEF_IMOD_STATIC_DATA - DEF_OMOD_STATIC_DATA - DEF_PMOD_STATIC_DATA - DEF_FMOD_STATIC_DATA - DEFobjStaticHelpers - SIMP_PROP(...) And all `queryEtryPt()` dispatch macros: - CODEqueryEtryPt_STD_MOD_QUERIES - CODEqueryEtryPt_STD_OMOD_QUERIES - CODEqueryEtryPt_STD_OMODTX_QUERIES - CODEqueryEtryPt_STD_OMOD8_QUERIES - CODEqueryEtryPt_TXIF_OMOD_QUERIES - CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES - CODEqueryEtryPt_STD_IMOD_QUERIES - CODEqueryEtryPt_STD_CONF2_QUERIES - CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES - CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES - CODEqueryEtryPt_STD_CONF2_IMOD_QUERIES - CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES - CODEqueryEtryPt_STD_CONF2_CNFNAME_QUERIES - CODEqueryEtryPt_STD_PMOD_QUERIES - CODEqueryEtryPt_STD_PMOD2_QUERIES - CODEqueryEtryPt_STD_FMOD_QUERIES - CODEqueryEtryPt_STD_SMOD_QUERIES - CODEqueryEtryPt_doHUPWrkr - CODEqueryEtryPt_doHUP This general modernization reduces macro misuse, improves DX, and lays the foundation for a robust, automated style normalization system. See also: https://github.com/rsyslog/rsyslog/issues/5747
This directory contains a number of possibly useful things that do not directly relate to rsyslog. They are not actively supported, but as I said often helpful. Use them with some care, as they may be outdated in respect to the current release of rsyslog. At least some of this stuff has been found by our users and been included after a brief check and possibly an adaptation. If you have something useful you would like to see in contrib, just drop us a note (see https://www.rsyslog.com for how to do that at the time your are reading this document). rgerhards, 2007-08-08