From: David Lamparter Date: Tue, 14 Jul 2020 17:46:55 +0000 (+0200) Subject: tools/gcc-frr-format: improve test X-Git-Tag: base_7.5~178^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=555cc1001d40113829c016894507a7ded9faba7e;p=matthieu%2Ffrr.git tools/gcc-frr-format: improve test Signed-off-by: David Lamparter --- diff --git a/tools/gcc-plugins/format-test.c b/tools/gcc-plugins/format-test.c index b031ca5ece..fb7e41c7be 100644 --- a/tools/gcc-plugins/format-test.c +++ b/tools/gcc-plugins/format-test.c @@ -82,6 +82,12 @@ int test(unsigned long long ay) testfn("%Ld", v_pid_t); // WARN testfn("%Ld", v_uint64_t); // NOWARN + /* retain-typeinfo patch */ + testfn("%zu", (size_t)v_pid_t); // NOWARN (need retain-typeinfo patch) + testfn("%lu", (size_t)v_pid_t); // WARN (need retain-typeinfo patch) + testfn("%Lu", (uint64_t)v_pid_t); // NOWARN (need retain-typeinfo patch) + testfn("%lu", (uint64_t)v_pid_t); // WARN (need retain-typeinfo patch) + testfn("%pI4", &v_long); // WARN in_addr_t v_in_addr_t; diff --git a/tools/gcc-plugins/format-test.py b/tools/gcc-plugins/format-test.py index cc6ca6100e..df2437d5bc 100644 --- a/tools/gcc-plugins/format-test.py +++ b/tools/gcc-plugins/format-test.py @@ -10,6 +10,10 @@ for k in list(os.environ.keys()): if k.startswith('LC_'): os.environ.pop(k) +if len(sys.argv) < 2: + sys.stderr.write('start as format-test.py gcc-123.45 [-options ...]\n') + sys.exit(1) + c_re = re.compile(r'//\s+(NO)?WARN') expect = {} lines = {} @@ -25,9 +29,9 @@ with open('format-test.c', 'r') as fd: else: expect[lno] = 'nowarn' -cmd = shlex.split('gcc -Wall -Wextra -Wno-unused -fplugin=./frr-format.so -fno-diagnostics-show-caret -c -o format-test.o format-test.c') +cmd = shlex.split('-Wall -Wextra -Wno-unused -fplugin=./frr-format.so -fno-diagnostics-show-caret -c -o format-test.o format-test.c') -gcc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +gcc = subprocess.Popen(sys.argv[1:] + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) sout, serr = gcc.communicate() gcc.wait()