Repository navigation
Conversation
yaml_get_max_nest_level(), introduced in yaml#335, was declared and defined with an empty parameter list. Before C23 that declares a function without a prototype, which is obsolescent and is diagnosed by -Wstrict-prototypes, and by -Wmissing-prototypes at the definition (an empty list is not a prototype that can precede it). Code that includes yaml.h with those warnings enabled, and treated as errors, fails to compile. Use (void) in both places, as the other zero-argument functions in yaml.h do. The meaning is unchanged, and in C23 () and (void) are equivalent. This is the only empty parameter list in include/ and src/. With the change, compiling src/*.c with -Wall -Wstrict-prototypes -Wmissing-prototypes gives no warnings under gnu99, gnu17 and gnu23.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
yaml_get_max_nest_level(), introduced in #335, was declared and defined with an empty parameter list (()). Before C23 that declares a function without a prototype, which is obsolescent and is diagnosed by-Wstrict-prototypes, and by-Wmissing-prototypesat the definition (an empty list is not a prototype that can precede it).In C23,
()is equivalent to(void), so there is no problem compiling for C23. But older clients that includeyaml.hwith those warnings enabled and treated as errors fail to compile.This change uses
(void)in both places, as the other zero-argument functions inyaml.hdo. The meaning is unchanged, and in C23()and(void)are equivalent, so there is no drawback to this (indeed, it arguably makes it match project style even for C23).With the change, compiling
src/*.cwith-Wall -Wstrict-prototypes -Wmissing-prototypesgives no warnings as far back as C89.