]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CI: Add TinyCC (aka TCC) support
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 19 May 2024 07:33:52 +0000 (09:33 +0200)
committerfxlb <[email protected]>
Mon, 20 May 2024 11:17:09 +0000 (11:17 +0000)
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.

build.sh
build_common.sh

index c82591ace9b9d9ccb05dfdb6082cdd9025034cd3..0457e655d032c63e78e7ba4a13408b4e9efc7ee6 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -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
index 516c90cc6130f66c156f2f669b3ac56ca2fa9ac0..ce9349edb7710f62a15c11d81e24869272ded915 100644 (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-*)