avrdudes / avrdude

AVRDUDE is a utility to program AVR microcontrollers
GNU General Public License v2.0
734 stars 136 forks source link

Compile warnings from github action runs #1150

Closed mcuee closed 2 years ago

mcuee commented 2 years ago

1) macOS git main https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795

/Users/runner/work/avrdude/avrdude/src/flip2.c:126:12: warning: unused function 'flip2_open' [-Wunused-function]
static int flip2_open(PROGRAMMER *pgm, const char *port_spec);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:127:12: warning: unused function 'flip2_initialize' [-Wunused-function]
static int flip2_initialize(const PROGRAMMER *pgm, const AVRPART *part);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[28](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:29):13: warning: unused function 'flip2_close' [-Wunused-function]
static void flip2_close(PROGRAMMER* pgm);
            ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[29](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:30):13: warning: unused function 'flip2_enable' [-Wunused-function]
static void flip2_enable(PROGRAMMER *pgm, const AVRPART *p);
            ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[30](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:31):13: warning: unused function 'flip2_disable' [-Wunused-function]
static void flip2_disable(const PROGRAMMER *pgm);
            ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[31](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:32):13: warning: unused function 'flip2_display' [-Wunused-function]
static void flip2_display(const PROGRAMMER *pgm, const char *prefix);
            ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[32](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:33):12: warning: unused function 'flip2_program_enable' [-Wunused-function]
static int flip2_program_enable(const PROGRAMMER *pgm, const AVRPART *part);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[33](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:34):12: warning: unused function 'flip2_chip_erase' [-Wunused-function]
static int flip2_chip_erase(const PROGRAMMER *pgm, const AVRPART *part);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[34](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:35):12: warning: unused function 'flip2_start_app' [-Wunused-function]
static int flip2_start_app(const PROGRAMMER *pgm);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[35](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:36):12: warning: unused function 'flip2_read_byte' [-Wunused-function]
static int flip2_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem,
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[37](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:38):12: warning: unused function 'flip2_write_byte' [-Wunused-function]
static int flip2_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem,
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[39](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:40):12: warning: unused function 'flip2_paged_load' [-Wunused-function]
static int flip2_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem,
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[41](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:42):12: warning: unused function 'flip2_paged_write' [-Wunused-function]
static int flip2_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem,
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[43](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:44):12: warning: unused function 'flip2_read_sig_bytes' [-Wunused-function]
static int flip2_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[44](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:45):12: warning: unused function 'flip2_parseexitspecs' [-Wunused-function]
static int flip2_parseexitspecs(PROGRAMMER* pgm, const char *s);
           ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[45](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:46):13: warning: unused function 'flip2_setup' [-Wunused-function]
static void flip2_setup(PROGRAMMER * pgm);
            ^
/Users/runner/work/avrdude/avrdude/src/flip2.c:1[46](https://github.com/avrdudes/avrdude/actions/runs/3266550590/jobs/5370443795#step:5:47):13: warning: unused function 'flip2_teardown' [-Wunused-function]
static void flip2_teardown(PROGRAMMER * pgm);
            ^
17 warnings generated.
mcuee commented 2 years ago
  1. MSYS2 mingw32/ming64 build.
In function 'tokenize',
    inlined from 'terminal_mode' at D:/a/avrdude/avrdude/src/term.c:1259:12:
D:/a/avrdude/avrdude/src/term.c:1149:17: warning: pointer 'buf' may be used after 'realloc' [-Wuse-after-free]
 1149 |       ptrdiff_t k = buf - bufp;
      |                 ^
D:/a/avrdude/avrdude/src/term.c:1133:18: note: call to 'realloc' here
 1133 |       buf_tmp  = realloc(buf, bufsize);
      |                  ^~~~~~~~~~~~~~~~~~~~~

I am not so sure if this one is valid or not. MSYS2 clang64 build is okay in my local machine. Usually clang can be a bit more strict than gcc but not in this case.

 CLANG64 /c/work/avr/avrdude_test/avrdude_main
$ ./build.sh
-- Looking for libelf.h
-- Looking for libelf.h - found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
CMake Warning (dev) at src/CMakeLists.txt:135 (add_library):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    C:/work/avr/avrdude_test/avrdude_main/src/ac_cfg.h.in
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22000
[1/57] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.obj
[2/57] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.obj
[3/57] Building C object src/CMakeFiles/libavrdude.dir/avrpart.c.obj
[4/57] Building C object src/CMakeFiles/libavrdude.dir/avr.c.obj
[5/57] Building C object src/CMakeFiles/libavrdude.dir/butterfly.c.obj
[6/57] Building C object src/CMakeFiles/libavrdude.dir/avrcache.c.obj
[7/57] Building C object src/CMakeFiles/libavrdude.dir/buspirate.c.obj
[8/57] Building C object src/CMakeFiles/libavrdude.dir/config.c.obj
[9/57] Building C object src/CMakeFiles/libavrdude.dir/dfu.c.obj
[10/57] Building C object src/CMakeFiles/libavrdude.dir/flip1.c.obj
[11/57] Building C object src/CMakeFiles/libavrdude.dir/flip2.c.obj
[12/57] Building C object src/CMakeFiles/libavrdude.dir/bitbang.c.obj
[13/57] Building C object src/CMakeFiles/libavrdude.dir/confwin.c.obj
[14/57] Building C object src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj
[15/57] Building C object src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.obj
[16/57] Building C object src/CMakeFiles/libavrdude.dir/linuxgpio.c.obj
[17/57] Building C object src/CMakeFiles/libavrdude.dir/fileio.c.obj
[18/57] Building C object src/CMakeFiles/libavrdude.dir/linuxspi.c.obj
[19/57] Building C object src/CMakeFiles/libavrdude.dir/par.c.obj
[20/57] Building C object src/CMakeFiles/libavrdude.dir/lists.c.obj
[21/57] Building C object src/CMakeFiles/libavrdude.dir/pgm.c.obj
[22/57] Building C object src/CMakeFiles/libavrdude.dir/pgm_type.c.obj
[23/57] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.obj
[24/57] Building C object src/CMakeFiles/libavrdude.dir/ppiwin.c.obj
[25/57] Building C object src/CMakeFiles/libavrdude.dir/micronucleus.c.obj
[26/57] Building C object src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.obj
[27/57] Building C object src/CMakeFiles/libavrdude.dir/pindefs.c.obj
[28/57] Building C object src/CMakeFiles/libavrdude.dir/jtag3.c.obj
[29/57] Building C object src/CMakeFiles/libavrdude.dir/serialupdi.c.obj
[30/57] Building C object src/CMakeFiles/libavrdude.dir/stk500generic.c.obj
[31/57] Building C object src/CMakeFiles/libavrdude.dir/jtagmkII.c.obj
[32/57] Building C object src/CMakeFiles/libavrdude.dir/pickit2.c.obj
[33/57] Building C object src/CMakeFiles/libavrdude.dir/updi_readwrite.c.obj
[34/57] Building C object src/CMakeFiles/libavrdude.dir/teensy.c.obj
[35/57] Building C object src/CMakeFiles/libavrdude.dir/ft245r.c.obj
[36/57] Building C object src/CMakeFiles/libavrdude.dir/stk500.c.obj
[37/57] Building C object src/CMakeFiles/libavrdude.dir/serbb_win32.c.obj
[38/57] Building C object src/CMakeFiles/libavrdude.dir/updi_state.c.obj
[39/57] Building C object src/CMakeFiles/libavrdude.dir/updi_link.c.obj
[40/57] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm.c.obj
[41/57] Building C object src/CMakeFiles/libavrdude.dir/ser_win32.c.obj
[42/57] Building C object src/CMakeFiles/libavrdude.dir/usb_hidapi.c.obj
[43/57] Building C object src/CMakeFiles/libavrdude.dir/wiring.c.obj
[44/57] Building C object src/CMakeFiles/libavrdude.dir/usb_libusb.c.obj
[45/57] Building C object src/CMakeFiles/libavrdude.dir/update.c.obj
[46/57] Building C object src/CMakeFiles/libavrdude.dir/usbtiny.c.obj
[47/57] Building C object src/CMakeFiles/avrdude.dir/avrintel.c.obj
[48/57] Building C object src/CMakeFiles/libavrdude.dir/xbee.c.obj
[49/57] Building C object src/CMakeFiles/libavrdude.dir/__/lexer.c.obj
[50/57] Building C object src/CMakeFiles/libavrdude.dir/__/config_gram.c.obj
[51/57] Building C object src/CMakeFiles/libavrdude.dir/stk500v2.c.obj
[52/57] Building C object src/CMakeFiles/avrdude.dir/main.c.obj
[53/57] Building C object src/CMakeFiles/avrdude.dir/term.c.obj
[54/57] Building C object src/CMakeFiles/libavrdude.dir/usbasp.c.obj
[55/57] Building C object src/CMakeFiles/avrdude.dir/developer_opts.c.obj
[56/57] Linking C static library src\libavrdude.a
[57/57] Linking C executable src\avrdude.exe

Build succeeded.

Run

sudo cmake --build build_mingw64_nt-10.0-22000 --target install

to install.
stefanrueger commented 2 years ago

flip2. macOS git main

I noticed that and solved it en passant in one of the PRs - should no longer happen.

  1. MSYS2 mingw32/ming64 build.
    
    In function 'tokenize',
    inlined from 'terminal_mode' at D:/a/avrdude/avrdude/src/term.c:1259:12:
    D:/a/avrdude/avrdude/src/term.c:1149:17: warning: pointer 'buf' may be used after 'realloc' [-Wuse-after-free]
    1149 |       ptrdiff_t k = buf - bufp;
    |                 ^
    D:/a/avrdude/avrdude/src/term.c:1133:18: note: call to 'realloc' here
    1133 |       buf_tmp  = realloc(buf, bufsize);
    |                  ^~~~~~~~~~~~~~~~~~~~~


This one is a false alarm warning that's kind of hard to get rid off (we discussed that before)

So, all things condidered this can be closed.