Skip to content

Pedantic - #217

Merged
twogood merged 4 commits into
twogood:mainfrom
kratz00:pedantic
Feb 20, 2026
Merged

twogood merged 4 commits into
twogood:mainfrom
kratz00:pedantic

Conversation

@kratz00

@kratz00 kratz00 commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

https://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Names.html

Note that these semantics are deprecated, and that GCC 3.2 will handle __FUNCTION__ and __PRETTY_FUNCTION__ the same way as __func__. __func__ is defined by the ISO standard C99:

##__VA_ARGS__ is GCC extension, an equivalent feature was added with the C23 standard, namely: VA_OPT
See also https://en.wikipedia.org/wiki/Variadic_macro_in_the_C_preprocessor#Trailing_comma

As a side note, GCC 15 will use C23 by default.

…d identifier

Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
…eprecated in all versions of C

Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
…xtension

Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
@kratz00
kratz00 marked this pull request as ready for review February 19, 2026 20:51
@twogood
twogood requested a review from Copilot February 20, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the codebase to use C23 standard compliance instead of relying on GCC-specific extensions. The changes replace deprecated and non-standard constructs with their C23 equivalents to improve portability and prepare for GCC 15 which will default to C23.

Changes:

  • Replace deprecated __FUNCTION__ with standard __func__ in logging macros
  • Replace GCC extension ##__VA_ARGS__ with C23 standard __VA_OPT__(,) __VA_ARGS__ syntax
  • Set CMake C standard to C23 and update test code to use int main(void) instead of int main()
  • Add -Wpedantic compiler flag to enforce strict standard compliance

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/log.h Updated logging macros to use __func__ and __VA_OPT__ instead of deprecated/GCC-specific constructs
CMakeLists.txt Set C standard to C23 and updated test main() signatures to include void parameter
.github/workflows/cmake.yml Added -Wpedantic flag to enforce strict standard compliance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CMakeLists.txt Resolved
@twogood

twogood commented Feb 20, 2026

Copy link
Copy Markdown
Owner

@kratz00 Whats are the pros and cons with setting CMAKE_C_STANDARD 17 instead?

@kratz00

kratz00 commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

As long as C_STANDARD_REQUIRED (https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD_REQUIRED.html) is not set to ON it's more like a recommendation.
VA_OPT is part of C23 (see https://www.iso-9899.info/wiki/The_Standard), so using C17 does not make sense to me.

@twogood

twogood commented Feb 20, 2026

Copy link
Copy Markdown
Owner

Thanks, I suspected it was something like that!

@twogood
twogood merged commit 0f62d12 into twogood:main Feb 20, 2026
10 checks passed
@kratz00
kratz00 deleted the pedantic branch February 20, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants