src/json_value.h uses uint8_t in escapeAsJsonString but does not include <cstdint>. As a result, any translation unit that includes this header without first including <cstdint> (or another header that happens to define it) fails to compile.
Relevant code
File: src/json_value.h
Line 134 (inside escapeAsJsonString):
for(uint8_tc:s){
The file currently includes <cstddef>, <map>, <memory>, <optional>, <string>, <utility>, <variant>, <vector>, and "weaseljson.h", but not <cstdint>.
Reproduction
Create a minimal source file that includes only this header:
#include"json_value.h"intmain(){return0;}
Compile:
c++ -std=c++20 -Iinclude -Isrc -c repro.cpp
Result:
src/json_value.h:134:8: error: ‘uint8_t’ was not declared in this scope
134 | for (uint8_t c : s) {
| ^~~~~~~
Expected behavior
Every project header should be self-contained. src/json_value.h should explicitly include <cstdint> so it compiles regardless of include order.
Actual behavior
Compilation fails unless a previously included header has already defined uint8_t. The current build works only because src/fuzz.cpp includes src/callbacks.h before src/json_value.h, and callbacks.h happens to include <cstdint>.
Impact
This makes json_value.h fragile to use in other tools or tests. Any reordering of includes, or any consumer that includes json_value.h directly, will hit a cryptic compile error. The fix is a one-line addition of #include <cstdint>.
`src/json_value.h` uses `uint8_t` in `escapeAsJsonString` but does not include `<cstdint>`. As a result, any translation unit that includes this header without first including `<cstdint>` (or another header that happens to define it) fails to compile.
**Relevant code**
File: `src/json_value.h`
Line 134 (inside `escapeAsJsonString`):
```cpp
for (uint8_t c : s) {
```
The file currently includes `<cstddef>`, `<map>`, `<memory>`, `<optional>`, `<string>`, `<utility>`, `<variant>`, `<vector>`, and `"weaseljson.h"`, but not `<cstdint>`.
**Reproduction**
Create a minimal source file that includes only this header:
```cpp
#include "json_value.h"
int main() { return 0; }
```
Compile:
```sh
c++ -std=c++20 -Iinclude -Isrc -c repro.cpp
```
Result:
```
src/json_value.h:134:8: error: ‘uint8_t’ was not declared in this scope
134 | for (uint8_t c : s) {
| ^~~~~~~
```
**Expected behavior**
Every project header should be self-contained. `src/json_value.h` should explicitly include `<cstdint>` so it compiles regardless of include order.
**Actual behavior**
Compilation fails unless a previously included header has already defined `uint8_t`. The current build works only because `src/fuzz.cpp` includes `src/callbacks.h` before `src/json_value.h`, and `callbacks.h` happens to include `<cstdint>`.
**Impact**
This makes `json_value.h` fragile to use in other tools or tests. Any reordering of includes, or any consumer that includes `json_value.h` directly, will hit a cryptic compile error. The fix is a one-line addition of `#include <cstdint>`.
weaselbot
was assigned by andrew2026-06-29 17:33:55 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
src/json_value.husesuint8_tinescapeAsJsonStringbut does not include<cstdint>. As a result, any translation unit that includes this header without first including<cstdint>(or another header that happens to define it) fails to compile.Relevant code
File:
src/json_value.hLine 134 (inside
escapeAsJsonString):The file currently includes
<cstddef>,<map>,<memory>,<optional>,<string>,<utility>,<variant>,<vector>, and"weaseljson.h", but not<cstdint>.Reproduction
Create a minimal source file that includes only this header:
Compile:
Result:
Expected behavior
Every project header should be self-contained.
src/json_value.hshould explicitly include<cstdint>so it compiles regardless of include order.Actual behavior
Compilation fails unless a previously included header has already defined
uint8_t. The current build works only becausesrc/fuzz.cppincludessrc/callbacks.hbeforesrc/json_value.h, andcallbacks.hhappens to include<cstdint>.Impact
This makes
json_value.hfragile to use in other tools or tests. Any reordering of includes, or any consumer that includesjson_value.hdirectly, will hit a cryptic compile error. The fix is a one-line addition of#include <cstdint>.