CI: Add TinyCC (aka TCC) support

Identification examples: tcc-0.9.27, tcc-0.9.28rc

There are currently warnings such as:
print-802_11.c:3317: warning: assignment discards qualifiers from pointer
  target type
print-esp.c:373: warning: function might return no value: 'ldp_pdu_print'
So use: TCPDUMP_TAINTED=yes

Works on linux-amd64.
Does not work on linux-armv7l with BUILD_LIBPCAP=yes / CMAKE=yes
(Segmentation fault, libpcap dynamically linked). Works with 0.9.28rc.

TinyCC can be found at https://bellard.org/tcc/,
https://repo.or.cz/r/tinycc.git or as package on some distros.
This commit is contained in:
Francois-Xavier Le Bail 2024-05-19 09:33:52 +02:00 committed by fxlb
parent 83d7ac7aac
commit 57f1c409a4
2 changed files with 19 additions and 2 deletions

View File

@ -35,6 +35,12 @@ print_cc_version
# later warnings in the same matrix subset trigger an error.
case `cc_id`/`os_id` in
tcc-*/*)
# print-802_11.c:3317: warning: assignment discards qualifiers from pointer
# target type
# print-esp.c:373: warning: function might return no value: 'ldp_pdu_print'
TCPDUMP_TAINTED=yes
;;
*)
;;
esac

View File

@ -63,7 +63,7 @@ print_sysinfo() {
cc_version_nocache() {
: "${CC:?}"
case `basename "$CC"` in
gcc*|egcc*|clang*)
gcc*|egcc*|clang*|tcc*)
# GCC and Clang recognize --version, print to stdout and exit with 0.
"$CC" --version
;;
@ -151,6 +151,17 @@ cc_id_nocache() {
return
fi
# Examples of installed packages:
# "tcc version 0.9.27 (x86_64 Linux)"
# "tcc version 0.9.27 2023-07-05 mob@5b28165 (x86_64 OpenBSD)"
# Example of a development version:
# "tcc version 0.9.28rc 2024-04-28 mob@0aca8611 (x86_64 Linux)"
cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^.*tcc version \([0-9\.rc]*\).*$/tcc-\1/'`
if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
echo "$cc_id_guessed"
return
fi
# OpenBSD default GCC:
# "gcc (GCC) 4.2.1 20070719"
# RedHat GCC:
@ -187,7 +198,7 @@ discard_cc_cache() {
# warnings as errors.
cc_werr_cflags() {
case `cc_id` in
gcc-*|clang-*)
gcc-*|clang-*|tcc-*)
echo '-Werror'
;;
xlc-*)