Skip to content

Add missing prototype for newlineScanByteCountForTesting - #1715

Open
afonsojanu wants to merge 1 commit into
open-source-parsers:masterfrom
afonsojanu:fix/newline-scan-missing-prototype
Open

Add missing prototype for newlineScanByteCountForTesting#1715
afonsojanu wants to merge 1 commit into
open-source-parsers:masterfrom
afonsojanu:fix/newline-scan-missing-prototype

Conversation

@afonsojanu

Copy link
Copy Markdown

Fixes #1705.

newlineScanByteCountForTesting() in json_reader.cpp is defined with no prior declaration in the same translation unit. Building with stricter warning flags (clang's -Wmissing-prototypes, as reported from the OpenXR SDK build) flags it as a possible externally-callable function with no visible prototype, even though it's test-only instrumentation (main.cpp forward-declares it itself before using it, since it's not part of any installed header).

Adds a plain prototype directly above the definition, matching what you suggested in the issue. This silences the warning without changing the public API surface at all: the function still isn't declared anywhere in include/.

Verified with a standalone clang++ -Wmissing-prototypes -Werror compile of json_reader.cpp: fails with the exact error from the issue on unmodified master, passes with this change. Also reran the full meson/ninja test suite (unittest_jsoncpp_test, unittest_jsontestrunner, jsonchecker_jsontestrunner), all green, and ran clang-format per CONTRIBUTING.md with no further diff.

Fixes open-source-parsersGH-1705. json_reader.cpp defines this function with no prior
declaration in the same translation unit, so building with stricter
flags like clang's -Wmissing-prototypes flags it as a possible
externally-callable function with no visible prototype, even though
it's only meant for the unit tests (main.cpp forward-declares it
itself before using it).

Adding a plain prototype directly above the definition, same as the
reporter suggested, silences the warning without touching the public
API surface: the function still isn't declared in any installed
header.

Reran the full meson/ninja test suite (all 3 suites green) and
confirmed with a standalone clang++ compile that
-Wmissing-prototypes -Werror on json_reader.cpp fails before this
change and passes after it. Also ran clang-format per CONTRIBUTING.md,
no further diff.
@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a forward declaration for the test-only newlineScanByteCountForTesting() function so strict missing-prototype builds succeed without expanding the installed public API.

  • Declares the function immediately before its existing definition.
  • Preserves the function’s signature, visibility annotation, and behavior.

Confidence Score: 5/5

The PR appears safe to merge with no actionable issues identified.

The added declaration exactly matches the adjacent existing definition and only addresses strict compiler prototype diagnostics without altering behavior or the installed API.

Important Files Changed

Filename Overview
src/lib_json/json_reader.cpp Adds a matching prototype for existing test instrumentation; no runtime behavior or public-header surface changes.

Reviews (1): Last reviewed commit: "Add missing prototype for newlineScanByt..." | Re-trigger Greptile

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.

Missing prototype for function added in 1.9.8

1 participant