Skip to content

Fix missing prototype for newlineScanByteCountForTesting - #1720

Open
Tyagiquamar wants to merge 1 commit into
open-source-parsers:masterfrom
Tyagiquamar:fix-missing-prototype-1705
Open

Tyagiquamar wants to merge 1 commit into
open-source-parsers:masterfrom
Tyagiquamar:fix-missing-prototype-1705

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Problem

When compiling JsonCpp with -Wmissing-prototypes (or strict compiler flags treating missing function prototypes as errors), GCC/Clang emits a compiler error in src/lib_json/json_reader.cpp:

error: no previous prototype for 'size_t& Json::newlineScanByteCountForTesting()' [-Werror=missing-prototypes]

Fixes #1705.

Solution

Add explicit prototype declaration JSON_API size_t& newlineScanByteCountForTesting(); matching the function signature before its definition in src/lib_json/json_reader.cpp.

Verification

  • Built in Docker with GCC 14 and -DCMAKE_CXX_FLAGS='-Wmissing-prototypes': compiled cleanly with zero errors/warnings on newlineScanByteCountForTesting.
  • Ran full test suite in Docker: all 131 tests passed (100% pass rate).

Closes open-source-parsers#1705. Adds explicit prototype declaration for
newlineScanByteCountForTesting() to prevent compiler errors when
building with -Wmissing-prototypes.

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Adds forward declaration for internal testing function.

The PR appears safe to merge.

Summary

The PR adds a matching forward declaration for Json::newlineScanByteCountForTesting() to address strict-compiler missing-prototype diagnostics.

  • The declaration does not change parser behavior or the function’s linkage.

Reviews (1) · Last reviewed commit: "Fix missing prototype for newlineScanByt..."

This branch has not been deployed

No deployments
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