Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and improve abstract reader/writer interface #208

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0ff814d
CI: add dependabot configuration
pjonsson Nov 2, 2023
2265e82
CI: add Github CI
pjonsson Nov 2, 2023
ad60cea
follow-up commit to 75eaa19
lightyear15 Feb 13, 2024
8907f20
Tests: disable the C90 test
thiagomacieira May 2, 2024
89723e2
CI: Get Homebrew to use a bottle (precompiled) Qt
thiagomacieira May 2, 2024
f9fd089
CI: remove Valgrind on macOS: it doesn't work
thiagomacieira May 2, 2024
e9963de
CI/Makefile: do allow Qt 6
thiagomacieira May 2, 2024
6550f66
CI: unbreak macOS: need to have CXX set
thiagomacieira May 2, 2024
a38a520
CI: Run the configure step in verbose mode and print the config output
thiagomacieira May 2, 2024
5d167a0
Makefile: disable cJSON support when building without math support
thiagomacieira May 1, 2024
722318d
add required SECURITY.md file for OSSF Scorecard compliance
rdower May 3, 2024
b4e1cc7
CI: add 'permissions' token to the GitHub actions file
thiagomacieira May 13, 2024
f994144
cborparser: Move parser initialisation to common routine.
sjlongland Jun 30, 2021
167eef6
cborparser: Document `cbor_parser_init_reader`.
sjlongland Jun 30, 2021
286d132
cbor: Document the reader interface.
sjlongland Jun 30, 2021
3394f51
cborparser: Pass CborValue to operation routines.
sjlongland Jul 2, 2021
b7287ff
cborparser: Move `ops` outside of `union`
sjlongland Jul 2, 2021
da482b2
cborparser: Move the reader context to CborParser.
sjlongland Jul 2, 2021
72d59f1
cborparser: Update documentation
sjlongland Jul 3, 2021
1ef9a05
reader unit tests: Simplify the example reader
sjlongland Jul 3, 2021
b4b41d3
cborencoder: Document the write callback function.
sjlongland Jul 3, 2021
914bee9
examples: Add buffered writer example.
sjlongland Jul 7, 2021
34e931e
examples: Add buffered reader example
sjlongland Jul 7, 2021
0c17e0f
cbor.h, cborencoder.c: Migrate documentation for encoder functions
sjlongland Sep 7, 2021
a4a6364
cbor.h, cborparser.c: Migrate parser documentation.
sjlongland Sep 7, 2021
427e009
parser unit tests: Do not use `auto`, use reinterpret_cast
sjlongland Sep 7, 2021
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
target-branch: "main"
140 changes: 140 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: CI
permissions: read-all

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
TinyCBOR:
timeout-minutes: 45
# Common environment variables
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS: 1

strategy:
# Always run all jobs in the matrix, even if one fails.
fail-fast: false
matrix:
os: [ ubuntu-latest ]
build_cfg: [
{ "name": "gcc-no-math",
"flags":
'{ "QMAKESPEC": "linux-gcc-no-math",
"EVAL": "export CXX=false && touch math.h float.h",
"CFLAGS": "-ffreestanding -DCBOR_NO_FLOATING_POINT -Os",
"LDFLAGS": "-Wl,--no-undefined",
"LDLIBS": ""
}',
},
{ "name": "gcc-freestanding",
"flags":
'{ "QMAKESPEC": "linux-gcc-freestanding",
"EVAL": "export CXX=false",
"CFLAGS": "-ffreestanding -Os",
"LDFLAGS": "-Wl,--no-undefined -lm"
}',
},
{ "name": "clang",
"flags":
'{ "QMAKESPEC": "linux-clang",
"EVAL": "export CC=clang && export CXX=clang++",
"CFLAGS": "-Oz",
"LDFLAGS": "-Wl,--no-undefined -lm",
"QMAKEFLAGS": "-config release",
"MAKEFLAGS": "-s",
"TESTARGS": "-silent"
}',
},
{ "name": "linux-g++",
"flags":
'{ "QMAKESPEC": "linux-g++",
"EVAL": "export CC=gcc && export CXX=g++",
"CFLAGS": "-Os",
"LDFLAGS": "-Wl,--no-undefined -lm",
"QMAKEFLAGS": "-config release",
"QT_NO_CPU_FEATURE": "rdrnd"
}'
}
]
include:
- os: macos-13
build_cfg: { "name": "clang",
"flags":
'{ "QMAKESPEC": "macx-clang",
"EVAL": "export CC=clang && export CXX=clang++",
"CFLAGS": "-Oz",
"QMAKEFLAGS": "-config debug",
"MAKEFLAGS": "-s",
"TESTARGS": "-silent",
"PATH": "/usr/local/opt/qt/bin:$PATH"
}'
}

# Default job name is too long to be visible in the "Checks" tab.
name: ${{ matrix.os }}/${{ matrix.build_cfg.name }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
steps:
- name: Clone tinycbor
uses: actions/checkout@v4

- name: install Linux software
if: matrix.os == 'ubuntu-latest'
run: |
# Need a recent Valgrind, otherwise debug info cannot be read.
sudo snap install valgrind --classic
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
doxygen \
jq \
libc6-dbg \
libcjson-dev \
libfuntools-dev \
qtbase5-dev

- name: install macOS software
if: runner.os == 'macOS'
run: |
# Doxygen 1.9.7 is broken with ifdefs again, install 1.9.4 which works.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/41828ee36b96e35b63b2a4c8cfc2df2c3728944a/Formula/doxygen.rb
brew install doxygen.rb
rm doxygen.rb
brew install qt cjson

- name: Execute tests
run: |
set -x
PATH=`echo /opt/qt*/bin`:$PATH
eval $(echo '${{ matrix.build_cfg.flags }}' | jq -r 'to_entries[] | "\(.key)=\"\(.value)\""')
eval "$EVAL"
# FIXME: remove -Wno-error-line below.
export CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration"
make OUT=.config V=1 -s -f Makefile.configure configure && cat .config
make -k \
CFLAGS="$CFLAGS -march=native -g1 -Wall -Wextra -Werror" \
CPPFLAGS="-DNDEBUG -DCBOR_ENCODER_WRITER_CONTROL=-1 -DCBOR_PARSER_READER_CONTROL=-1" \
lib/libtinycbor.a
size lib/libtinycbor.a | tee sizes
make -s clean
make -k \
CFLAGS="$CFLAGS -O0 -g" \
LDFLAGS="$LDFLAGS" ${LDLIBS+LDLIBS="$LDLIBS"}
grep -q freestanding-pass .config || make \
QMAKEFLAGS="$QMAKEFLAGS QMAKE_CXX=$CXX" \
tests/Makefile
grep -q freestanding-pass .config || \
(cd tests && make TESTARGS=-silent check -k \
TESTRUNNER=`which valgrind 2>/dev/null`)
make -s clean
! [ $BUILD_DOCS ] || ./scripts/update-docs.sh
14 changes: 0 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ VERSION = $(shell cat $(SRCDIR)VERSION)
SOVERSION = $(shell cut -f1-2 -d. $(SRCDIR)VERSION)
PACKAGE = tinycbor-$(VERSION)

# Check that QMAKE is Qt 5
ifeq ($(origin QMAKE),file)
check_qmake = $(strip $(shell $(1) -query QT_VERSION 2>/dev/null | cut -b1))
ifneq ($(call check_qmake,$(QMAKE)),5)
QMAKE := qmake -qt5
ifneq ($(call check_qmake,$(QMAKE)),5)
QMAKE := qmake-qt5
ifneq ($(call check_qmake,$(QMAKE)),5)
QMAKE := @echo >&2 $(MAKEFILE): Cannot find a Qt 5 qmake; false
endif
endif
endif
endif

-include .config

ifeq ($(wildcard .config),)
Expand Down
7 changes: 4 additions & 3 deletions Makefile.configure
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ PROGRAM-freestanding += int main() {}
CCFLAGS-freestanding = $(CFLAGS)

PROGRAM-cjson = \#include <stdlib.h>\n
PROGRAM-cjson += \#include <math.h>\n
PROGRAM-cjson += \#include <cjson/cJSON.h>\n
PROGRAM-cjson += int main() { return cJSON_False; }
CCFLAGS-cjson = -I$(dir $(MAKEFILE))src
PROGRAM-cjson += int main() { double d = NAN; return cJSON_False; }
CCFLAGS-cjson = -I. -I$(dir $(MAKEFILE))src
PROGRAM-system-cjson = $(PROGRAM-cjson)
CCFLAGS-system-cjson = -lcjson
CCFLAGS-system-cjson = -I. -lcjson

sink:
@echo >&2 Please run from the top-level Makefile.
Expand Down
5 changes: 5 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security Policy
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.

## Reporting a Vulnerability
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
Loading