Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bec5345
refactor: 避免未对齐访问
Ryan-CW-Code Dec 25, 2025
c8d8140
refactor: 手动实现访问非对其指针
Ryan-CW-Code Dec 25, 2025
9c9d896
refactor: 优化json存储结构
Ryan-CW-Code Jan 6, 2026
aa5fb75
refactor: 优化函数命名
Ryan-CW-Code Jan 6, 2026
9111db2
fix: inline模式chang修复并补充测试例程
Ryan-CW-Code Jan 6, 2026
4d15c73
feat: 兼容大端环境
Ryan-CW-Code Jan 6, 2026
40e7db5
test: 补充更多示例
Ryan-CW-Code Jan 6, 2026
938076d
test: 补充测试描述
Ryan-CW-Code Jan 6, 2026
e7a1efd
doc: 完善readme
Ryan-CW-Code Jan 6, 2026
0b97df2
refactor: 完善模糊测试覆盖率
Ryan-CW-Code Jan 6, 2026
14b3f07
refactor: 优化print double的实现
Ryan-CW-Code Jan 7, 2026
1141052
style: 整理目录
Ryan-CW-Code Jan 7, 2026
c02b973
test: 优化测试代码
Ryan-CW-Code Jan 7, 2026
a0c0742
refactor: RyanJsonCompareDouble 开放出来
Ryan-CW-Code Jan 7, 2026
3db45e2
refactor: 优化double打印实现
Ryan-CW-Code Jan 7, 2026
93dbbdd
test: 完善jsonUtils模糊测试覆盖率
Ryan-CW-Code Jan 7, 2026
92a59cf
test: 增加数据解析一致性测试,优化测试代码
Ryan-CW-Code Jan 7, 2026
65dff5d
refactor: 优化double打印
Ryan-CW-Code Jan 8, 2026
94cbf58
refactor: 撤回double解析共用的函数
Ryan-CW-Code Jan 8, 2026
83b338e
test: 优化测试代码
Ryan-CW-Code Jan 8, 2026
06ea8f8
refactor: 再次整合double的解析和打印
Ryan-CW-Code Jan 8, 2026
5a68fc1
refactor: 优化嵌入式平台打印Double
Ryan-CW-Code Jan 8, 2026
0cb3edc
doc: 更新readme
Ryan-CW-Code Jan 8, 2026
b8b98ca
refactor: 优化double打印实现
Ryan-CW-Code Jan 11, 2026
10593b6
test: 拆分fuzzer测试文件,更新字典
Ryan-CW-Code Jan 11, 2026
cbda13f
test: 优化部分测试代码
Ryan-CW-Code Jan 12, 2026
b63328e
doc: 更新readme
Ryan-CW-Code Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# 忽略外部包
externalModule/*
/test/externalModule/cJSON/**
/test/externalModule/yyjson/**
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
# Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming,-misc-include-cleaner'

Checks:
- "-*,clang-diagnostic-*,clang-analyzer-*,llvm-*,concurrency-*,performance-*,cert-*"
- "-*,clang-diagnostic-*,clang-analyzer-*,concurrency-*,performance-*,cert-*"
# 静默的窄化转换交给编译器来判断?
- 'llvm-*,-llvm-include-order'
- 'bugprone-*,-bugprone-easily-swappable-parameters'
- 'readability-identifier-naming'
- 'misc-*,-misc-const-correctness,-misc-no-recursion,-misc-include-cleaner'
Expand Down
10 changes: 10 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Index:
Background: Build # 开启后台索引

# 如果你的 compile_commands.json 不在根目录,需要在这里显式指定
CompileFlags:
CompilationDatabase: ".vscode"
Comment on lines +1 to +6
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if .clangd file exists and read its content
if [ -f ".clangd" ]; then
  echo "=== .clangd file content ==="
  cat -n .clangd
else
  echo ".clangd file not found"
fi

Repository: Ryan-CW-Code/RyanJson

Length of output: 409


🏁 Script executed:

# Search for compile_commands.json in common locations
echo "=== Searching for compile_commands.json ==="
find . -name "compile_commands.json" -type f 2>/dev/null | head -20

Repository: Ryan-CW-Code/RyanJson

Length of output: 108


🏁 Script executed:

# Check if .vscode directory exists and list its contents
if [ -d ".vscode" ]; then
  echo "=== .vscode directory contents ==="
  ls -la .vscode/ 2>/dev/null | head -20
else
  echo ".vscode directory does not exist"
fi

Repository: Ryan-CW-Code/RyanJson

Length of output: 273


compile_commands.json 文件缺失。

CompilationDatabase 配置指向 ".vscode" 目录,但 compile_commands.json 在该目录(以及根目录)中都不存在。clangd 无法找到编译数据库,将无法正确索引和分析代码。需要生成 compile_commands.json 文件或将配置路径指向正确位置。

🤖 Prompt for AI Agents
In @.clangd around lines 1-6, The .clangd config points CompilationDatabase to
".vscode" but compile_commands.json is missing; fix by either generating a
compilation database (e.g., enable CMake's CMAKE_EXPORT_COMPILE_COMMANDS or run
bear/scan-build to create compile_commands.json) and placing it in the ".vscode"
directory, or update the CompilationDatabase field in .clangd to the actual
directory containing the generated compile_commands.json (or remove the explicit
setting to use the project root). Ensure the file is named exactly
compile_commands.json so clangd can discover it.


Diagnostics:
UnusedIncludes: None # 关键:这会关闭“未使用头文件”的提示
MissingIncludes: None # 可选:关闭“缺失头文件”的提示
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ build
default.profdata
default.profraw
test/fuzzer/corpus
docs

fuzz-*
83 changes: 36 additions & 47 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
{
"clangd.enable": false,
"C_Cpp.intelliSenseEngine": "default",
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
"c-cpp-flylint.enable": true,
"Lua.codeLens.enable": false,
"Lua.hint.enable": false,
"Lua.completion.enable": false,
"Lua.format.enable": false,
"Lua.hover.enable": false,
"Lua.diagnostics.enable": false,
"Lua.semantic.enable": false,
"Lua.addonManager.enable": false,
"Lua.signatureHelp.enable": false,
"clangd.enable": true,
"clangd.arguments": [],
"liveServer.settings.file": "${workspaceFolder}/coverage/**",
"liveServer.settings.ignoreFiles": [
"**", // 第一步:先忽略所有文件(简单粗暴)
"!coverage/**" // 第二步:用感叹号 ! 把 coverage 目录“救”回来
],
"C_Cpp.intelliSenseEngine": "disabled",
"C_Cpp.errorSquiggles": "disabled", // 关闭微软的波浪线
"C_Cpp.autocomplete": "disabled", // 关闭微软的自动补全
"C_Cpp.default.compileCommands": "${workspaceFolder}/.vscode/compile_commands.json",
"C_Cpp.codeAnalysis.clangTidy.enabled": false,
"C_Cpp.codeAnalysis.clangTidy.args": [
// "--extra-arg=-ferror-limit=1"
// "--extra-arg=-m32",
"--extra-arg=--target=arm-none-eabi-gcc"
],
Comment on lines +23 to +27
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

目标三元组格式可能不正确。

--target=arm-none-eabi-gcc 中的 -gcc 后缀是编译器可执行文件名的一部分,不是目标架构的组成部分。正确的目标三元组应该是 arm-none-eabi

🔧 建议修复
     "C_Cpp.codeAnalysis.clangTidy.args": [
         // "--extra-arg=-ferror-limit=1"
         // "--extra-arg=-m32",
-        "--extra-arg=--target=arm-none-eabi-gcc"
+        "--extra-arg=--target=arm-none-eabi"
     ],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"C_Cpp.codeAnalysis.clangTidy.args": [
// "--extra-arg=-ferror-limit=1"
// "--extra-arg=-m32",
"--extra-arg=--target=arm-none-eabi-gcc"
],
"C_Cpp.codeAnalysis.clangTidy.args": [
// "--extra-arg=-ferror-limit=1"
// "--extra-arg=-m32",
"--extra-arg=--target=arm-none-eabi"
],
🤖 Prompt for AI Agents
In @.vscode/settings.json around lines 23 - 27, The value in
C_Cpp.codeAnalysis.clangTidy.args uses an incorrect target triple; replace the
string "--extra-arg=--target=arm-none-eabi-gcc" with
"--extra-arg=--target=arm-none-eabi" so the target triple is correct (remove the
"-gcc" compiler suffix) in the array assigned to
"C_Cpp.codeAnalysis.clangTidy.args".

"c-cpp-flylint.enable": false,
"c-cpp-flylint.cppcheck.severityLevels": {
"error": "Error",
"warning": "Warning",
Expand All @@ -12,49 +35,15 @@
"information": "Information"
},
"c-cpp-flylint.cppcheck.extraArgs": [
// "--suppress=constParameterPointer",
// "--suppress=constParameterCallback",
"--suppress=constParameterPointer",
"--suppress=constParameterCallback",
"--check-level=exhaustive",
// "--suppress=variableScope",
// "--suppress=unreadVariable",
// "--suppress=constVariablePointer",
// "--suppress=constParameter",
"--suppress=variableScope",
"--suppress=unreadVariable",
"--suppress=constVariablePointer",
"--suppress=constParameter",
"--suppress=unusedStructMember",
],
"files.watcherExclude": {
"**/test/fuzzer/corpus/**": true,
"./docs": true,
"./build": true,
"./.xmake": true,
},
"files.exclude": {
"**/test/fuzzer/corpus/**": true,
"./docs": true,
"./build": true,
"./.xmake": true,
},
"files.associations": {
"*.c": "c",
"inttypes.h": "c",
"float.h": "c",
"stdlib.h": "c",
"limits.h": "c",
"stdio.h": "c",
"stdint.h": "c",
"ryanjsontest.h": "c",
"dirent.h": "c",
"valloc.h": "c",
"initializer_list": "c",
"array": "c",
"string_view": "c",
"utility": "c",
"math.h": "c",
"compare": "c",
"type_traits": "c",
"cjson.h": "c",
"ryanjson.h": "c",
"string.h": "c",
"stdarg.h": "c",
"cstdlib": "c",
"ryanjsonconfig.h": "c"
},
"makefile.configureOnOpen": false,
"liveServer.settings.port": 5501
}
49 changes: 33 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@

CFLAGS_INC = -I RyanJson
CFLAGS_INC += -I cJSON
CFLAGS_INC += -I yyjson
CFLAGS_INC += -I RyanJsonExample/valloc
CFLAGS_INC += -I RyanJsonExample
# 编译器设置
CC = gcc
C_FLAGS = -std=gnu99 -O2 -Wall -Wextra -Wno-unused-parameter

# 头文件包含目录
CFLAGS_INC = -I ./RyanJson
CFLAGS_INC += -I ./example
CFLAGS_INC += -I ./test
CFLAGS_INC += -I ./test/baseTest
CFLAGS_INC += -I ./test/externalModule/valloc
CFLAGS_INC += -I ./test/externalModule/tlsf
CFLAGS_INC += -I ./test/externalModule/cJSON
CFLAGS_INC += -I ./test/externalModule/yyjson

# 源文件扫描 (排除 fuzzer)
src = $(wildcard ./RyanJson/*.c)
src += $(wildcard ./cJSON/*.c)
src += $(wildcard ./yyjson/*.c)
src += $(wildcard ./RyanJsonExample/valloc/*.c)
src += $(wildcard ./RyanJsonExample/*.c)
src += $(wildcard ./example/*.c)
src += $(wildcard ./test/*.c)
src += $(wildcard ./test/baseTest/*.c)
src += $(wildcard ./test/externalModule/valloc/*.c)
src += $(wildcard ./test/externalModule/tlsf/*.c)
src += $(wildcard ./test/externalModule/cJSON/*.c)
src += $(wildcard ./test/externalModule/yyjson/*.c)

obj = $(patsubst %.c, %.o, $(src))
target = app.o
CC = gcc
C_FLAGS = -Wall -Wextra -Wno-unused-parameter -Wformat=2
# 中间对象
obj = $(src:.c=.o)

# 目标程序 - 修改名字避免与源码文件夹 RyanJson 重名
target = app

# 默认规则
all: $(target)

$(target): $(obj)
$(CC) $(CFLAGS_INC) $(obj) $(C_FLAGS) -o $(target) -lm
$(CC) $(obj) $(C_FLAGS) -o $(target) -lm

# 编译模式规则
%.o: %.c
$(CC) $(CFLAGS_INC) $(C_FLAGS) -c $< -o $@ -lm
$(CC) $(CFLAGS_INC) $(C_FLAGS) -c $< -o $@

# 清理规则
.PHONY: clean
clean:
rm -rf $(obj) $(target)
rm -f $(obj) $(target)
Loading