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

Refactor legacy code to bypass warning - Phase 1 #736

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

minminlittleshrimp
Copy link
Collaborator

@minminlittleshrimp minminlittleshrimp commented Mar 15, 2025


cmake: satisfying CMP0115

Since CMake 3.20, CMake prefers all source files to
have their extensions explicitly listed. File extensions
*.c and *.cpp are added to CMakeLists.txt.

Update minimum cmake version to 3.10


lib, shared, daemon, gateway: refactor legacy code

dlt_user: recalculate exact path length buffers
dlt_client: correct function type
dlt_common: correct function type
dlt_multiple_files: recalculate buffer file name
dlt_daemon: recalculate exact path length buffers
dlt_daemon_common: recalculate exact path length buffers
dlt_gateway: correct function type, correct arg type

@minminlittleshrimp minminlittleshrimp force-pushed the dlt_devel_fix_cmake_warning branch 2 times, most recently from 74e5d02 to 6889860 Compare March 15, 2025 05:06
LUU QUANG MINH added 2 commits March 15, 2025 12:12
Since CMake 3.20, CMake prefers all source files to
have their extensions explicitly listed. File extensions
*.c and *.cpp are added to CMakeLists.txt.

Update minimum cmake version to 3.10

Signed-off-by: LUU QUANG MINH <[email protected]>
dlt_user: recalculate exact path length buffers
dlt_client: correct function type
dlt_common: correct function type
dlt_multiple_files: recalculate buffer file name
dlt_daemon: recalculate exact path length buffers
dlt_daemon_common: recalculate exact path length buffers
dlt_gateway: correct function type, correct arg type

Signed-off-by: LUU QUANG MINH <[email protected]>
@minminlittleshrimp minminlittleshrimp force-pushed the dlt_devel_fix_cmake_warning branch from 6889860 to db8a979 Compare March 15, 2025 05:12
@minminlittleshrimp minminlittleshrimp changed the title init for bug fix workspace Refactor legacy code to bypass warning Mar 15, 2025
@minminlittleshrimp
Copy link
Collaborator Author

Before:

Run cmake --build /home/runner/work/dlt-daemon/dlt-daemon/build --config Release
[  0%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_user.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c: In function ‘dlt_initialize_fifo_connection’:
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:404:45: warning: ‘/dltpipes’ directive output may be truncated writing 9 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  404 |     snprintf(dlt_user_dir, DLT_PATH_MAX, "%s/dltpipes", dltFifoBaseDir);
      |                                             ^~~~~~~~~
In file included from /usr/include/stdio.h:9[8](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:9)0,
                 from /home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_common.h:77,
                 from /home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_shm.h:5[9](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:10),
                 from /home/runner/work/dlt-daemon/dlt-daemon/build/include/dlt/dlt_user.h:99,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:75:
In function ‘snprintf’,
    inlined from ‘dlt_initialize_fifo_connection’ at /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:404:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:[10](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:11): note: ‘__builtin___snprintf_chk’ output between 10 and 1033 bytes into a destination of size 1024
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c: In function ‘dlt_initialize_fifo_connection’:
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:405:48: warning: ‘/dlt’ directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  405 |     snprintf(dlt_daemon_fifo, DLT_PATH_MAX, "%s/dlt", dltFifoBaseDir);
      |                                                ^~~~
In function ‘snprintf’,
    inlined from ‘dlt_initialize_fifo_connection’ at /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:405:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 5 and 1028 bytes into a destination of size 1024
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c: In function ‘dlt_initialize_fifo_connection’:
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:427:41: warning: ‘/dlt’ directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  427 |     snprintf(filename, DLT_PATH_MAX, "%s/dlt%d", dlt_user_dir, getpid());
      |                                         ^~~~
In function ‘snprintf’,
    inlined from ‘dlt_initialize_fifo_connection’ at /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:427:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 6 and 1039 bytes into a destination of size 1024
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c: In function ‘dlt_free’:
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:1085:45: warning: ‘/dlt’ directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1085 |         snprintf(filename, DLT_PATH_MAX, "%s/dlt%d", dlt_user_dir, getpid());
      |                                             ^~~~
In function ‘snprintf’,
    inlined from ‘dlt_free’ at /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_user.c:1085:9:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 6 and 1039 bytes into a destination of size 1024
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
[  1%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_client.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:[11](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:12)4:16: warning: conflicting types for ‘dlt_client_init_port’ due to enum/integer mismatch; have ‘DltReturnValue(DltClient *, int,  int)’ [-Wenum-int-mismatch]
  114 | DltReturnValue dlt_client_init_port(DltClient *client, int port, int verbose)
      |                ^~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:98:
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_client.h:119:5: note: previous declaration of ‘dlt_client_init_port’ with type ‘int(DltClient *, int,  int)’
  119 | int dlt_client_init_port(DltClient *client, int port, int verbose);
      |     ^~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:848:16: warning: conflicting types for ‘dlt_client_get_log_info’ due to enum/integer mismatch; have ‘DltReturnValue(DltClient *)’ [-Wenum-int-mismatch]
  848 | DltReturnValue dlt_client_get_log_info(DltClient *client)
      |                ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_client.h:199:5: note: previous declaration of ‘dlt_client_get_log_info’ with type ‘int(DltClient *)’
  199 | int dlt_client_get_log_info(DltClient *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:907:16: warning: conflicting types for ‘dlt_client_get_software_version’ due to enum/integer mismatch; have ‘DltReturnValue(DltClient *)’ [-Wenum-int-mismatch]
  907 | DltReturnValue dlt_client_get_software_version(DltClient *client)
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_client.h:211:5: note: previous declaration of ‘dlt_client_get_software_version’ with type ‘int(DltClient *)’
  211 | int dlt_client_get_software_version(DltClient *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  2%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_filetransfer.c.o
[  2%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_env_ll.c.o
[  3%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_common.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_common.c:2307:5: warning: conflicting types for ‘dlt_buffer_check_size’ due to enum/integer mismatch; have ‘int(DltBuffer *, int)’ [-Wenum-int-mismatch]
 2307 | int dlt_buffer_check_size(DltBuffer *buf, int needed)
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_shm.h:59,
                 from /home/runner/work/dlt-daemon/dlt-daemon/build/include/dlt/dlt_user.h:99,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_user_shared.h:72,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_common.c:41:
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_common.h:1441:16: note: previous declaration of ‘dlt_buffer_check_size’ with type ‘DltReturnValue(DltBuffer *, int)’
 1441 | DltReturnValue dlt_buffer_check_size(DltBuffer *buf, int needed);
      |                ^~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_common.c:2459:5: warning: conflicting types for ‘dlt_buffer_push3’ due to enum/integer mismatch; have ‘int(DltBuffer *, const unsigned char *, unsigned int,  const unsigned char *, unsigned int,  const unsigned char *, unsigned int)’ [-Wenum-int-mismatch]
 2459 | int dlt_buffer_push3(DltBuffer *buf,
      |     ^~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_common.h:1464:16: note: previous declaration of ‘dlt_buffer_push3’ with type ‘DltReturnValue(DltBuffer *, const unsigned char *, unsigned int,  const unsigned char *, unsigned int,  const unsigned char *, unsigned int)’
 1464 | DltReturnValue dlt_buffer_push3(DltBuffer *buf,
      |                ^~~~~~~~~~~~~~~~
[  4%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_log.c.o
[  4%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_multiple_files.c.o
In file included from /usr/include/string.h:548,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_multiple_files.c:29:
In function ‘strncat’,
    inlined from ‘multiple_files_buffer_file_name’ at /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_multiple_files.c:[12](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:13)8:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:[13](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:14)8:10: warning: ‘__builtin___strncat_chk’ accessing between 266 and 9223372036854775284 bytes at offsets 256 and 521 may overlap 1 byte at offset 521 [-Wrestrict]
  138 |   return __builtin___strncat_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncat’,
    inlined from ‘multiple_files_buffer_file_name’ at /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_multiple_files.c:131:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:138:10: warning: ‘__builtin___strncat_chk’ accessing 522 or more bytes at offsets 256 and 777 may overlap 1 byte at offset 777 [-Wrestrict]
  138 |   return __builtin___strncat_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
[  5%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_protocol.c.o
[  6%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_user_shared.c.o
[  6%] Linking C shared library libdlt.so
[  6%] Built target dlt
[  6%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt-daemon.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c: In function ‘option_handling’:
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c:366:17: warning: ‘/dltpipes’ directive output may be truncated writing 9 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  366 |              "%s/dltpipes", dltFifoBaseDir);
      |                 ^~~~~~~~~
In file included from /usr/include/stdio.h:980,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c:30:
In function ‘snprintf’,
    inlined from ‘option_handling’ at /home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c:365:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 10 and 1033 bytes into a destination of size 1024
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c: In function ‘option_handling’:
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c:368:17: warning: ‘/dlt’ directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  368 |              "%s/dlt", dltFifoBaseDir);
      |                 ^~~~
In function ‘snprintf’,
    inlined from ‘option_handling’ at /home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt-daemon.c:367:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 5 and 1028 bytes into a destination of size 1024
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
[  7%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_client.c.o
[  8%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_common.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt_daemon_common.c: In function ‘dlt_daemon_application_add’:
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt_daemon_common.c:732:23: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 255 [-Wformat-truncation=]
  732 |                      "%s/dltpipes/dlt%d",
      |                       ^~
  733 |                      dltFifoBaseDir,
      |                      ~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt_daemon_common.c:732:22: note: using the range [-2[14](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:15)7483648, 2147483647] for directive argument
  732 |                      "%s/dltpipes/dlt%d",
      |                      ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:980,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt_daemon_common.c:69:
In function ‘snprintf’,
    inlined from ‘dlt_daemon_application_add’ at /home/runner/work/dlt-daemon/dlt-daemon/src/daemon/dlt_daemon_common.c:730:13:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between [15](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:16) and 1048 bytes into a destination of size 255
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
[  8%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_connection.c.o
[  9%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_event_handler.c.o
[ 10%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_offline_logstorage.c.o
[ 10%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_serial.c.o
[ 11%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_socket.c.o
[ 11%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_unix_socket.c.o
[ 12%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/gateway/dlt_gateway.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/gateway/dlt_gateway.c:1283:[16](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:17): warning: conflicting types for ‘dlt_gateway_process_passive_node_messages’ due to enum/integer mismatch; have ‘DltReturnValue(DltDaemon *, DltDaemonLocal *, DltReceiver *, int)’ [-Wenum-int-mismatch]
 1283 | DltReturnValue dlt_gateway_process_passive_node_messages(DltDaemon *daemon,
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/dlt-daemon/dlt-daemon/src/gateway/dlt_gateway.c:39:
/home/runner/work/dlt-daemon/dlt-daemon/src/gateway/dlt_gateway.h:115:5: note: previous declaration of ‘dlt_gateway_process_passive_node_messages’ with type ‘int(DltDaemon *, DltDaemonLocal *, DltReceiver *, int)’
  115 | int dlt_gateway_process_passive_node_messages(DltDaemon *daemon,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/gateway/dlt_gateway.c:1613:48: warning: argument 3 of type ‘char[4]’ with mismatched bound [-Warray-parameter=]
 1613 |                                           char node_id[DLT_ID_SIZE],
      |                                           ~~~~~^~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/gateway/dlt_gateway.h:162:49: note: previously declared as ‘char *’
  162 |                                           char *node_id,
      |                                           ~~~~~~^~~~~~~
[ 13%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/lib/dlt_client.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:114:16: warning: conflicting types for ‘dlt_client_init_port’ due to enum/integer mismatch; have ‘DltReturnValue(DltClient *, int,  int)’ [-Wenum-int-mismatch]
  114 | DltReturnValue dlt_client_init_port(DltClient *client, int port, int verbose)
      |                ^~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:98:
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_client.h:119:5: note: previous declaration of ‘dlt_client_init_port’ with type ‘int(DltClient *, int,  int)’
  119 | int dlt_client_init_port(DltClient *client, int port, int verbose);
      |     ^~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:848:16: warning: conflicting types for ‘dlt_client_get_log_info’ due to enum/integer mismatch; have ‘DltReturnValue(DltClient *)’ [-Wenum-int-mismatch]
  848 | DltReturnValue dlt_client_get_log_info(DltClient *client)
      |                ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_client.h:199:5: note: previous declaration of ‘dlt_client_get_log_info’ with type ‘int(DltClient *)’
  199 | int dlt_client_get_log_info(DltClient *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/lib/dlt_client.c:907:16: warning: conflicting types for ‘dlt_client_get_software_version’ due to enum/integer mismatch; have ‘DltReturnValue(DltClient *)’ [-Wenum-int-mismatch]
  907 | DltReturnValue dlt_client_get_software_version(DltClient *client)
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_client.h:211:5: note: previous declaration of ‘dlt_client_get_software_version’ with type ‘int(DltClient *)’
  211 | int dlt_client_get_software_version(DltClient *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 13%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_common.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_common.c:2307:5: warning: conflicting types for ‘dlt_buffer_check_size’ due to enum/integer mismatch; have ‘int(DltBuffer *, int)’ [-Wenum-int-mismatch]
 2307 | int dlt_buffer_check_size(DltBuffer *buf, int needed)
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_shm.h:59,
                 from /home/runner/work/dlt-daemon/dlt-daemon/build/include/dlt/dlt_user.h:99,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_user_shared.h:72,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_common.c:41:
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_common.h:1441:16: note: previous declaration of ‘dlt_buffer_check_size’ with type ‘DltReturnValue(DltBuffer *, int)’
 1441 | DltReturnValue dlt_buffer_check_size(DltBuffer *buf, int needed);
      |                ^~~~~~~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_common.c:2459:5: warning: conflicting types for ‘dlt_buffer_push3’ due to enum/integer mismatch; have ‘int(DltBuffer *, const unsigned char *, unsigned int,  const unsigned char *, unsigned int,  const unsigned char *, unsigned int)’ [-Wenum-int-mismatch]
 2459 | int dlt_buffer_push3(DltBuffer *buf,
      |     ^~~~~~~~~~~~~~~~
/home/runner/work/dlt-daemon/dlt-daemon/include/dlt/dlt_common.h:1464:16: note: previous declaration of ‘dlt_buffer_push3’ with type ‘DltReturnValue(DltBuffer *, const unsigned char *, unsigned int,  const unsigned char *, unsigned int,  const unsigned char *, unsigned int)’
 1464 | DltReturnValue dlt_buffer_push3(DltBuffer *buf,
      |                ^~~~~~~~~~~~~~~~
[ 14%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_config_file_parser.c.o
[ 15%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_log.c.o
[ 15%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_multiple_files.c.o
In file included from /usr/include/string.h:548,
                 from /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_multiple_files.c:29:
In function ‘strncat’,
    inlined from ‘multiple_files_buffer_file_name’ at /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_multiple_files.c:128:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:138:10: warning: ‘__builtin___strncat_chk’ accessing between 266 and 9223372036854775284 bytes at offsets 256 and 521 may overlap 1 byte at offset 521 [-Wrestrict]
  138 |   return __builtin___strncat_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncat’,
    inlined from ‘multiple_files_buffer_file_name’ at /home/runner/work/dlt-daemon/dlt-daemon/src/shared/dlt_multiple_files.c:131:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:138:10: warning: ‘__builtin___strncat_chk’ accessing 522 or more bytes at offsets 256 and 777 may overlap 1 byte at offset 777 [-Wrestrict]
  138 |   return __builtin___strncat_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
[ 16%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_offline_trace.c.o
[ [17](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:18)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_protocol.c.o
[ 17%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_user_shared.c.o
[ [18](https://github.com/COVESA/dlt-daemon/actions/runs/13855040508/job/38769906917#step:5:19)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/offlinelogstorage/dlt_offline_logstorage.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c: In function ‘dlt_logstorage_check_gzip_compression’:
/home/runner/work/dlt-daemon/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c:1332:60: warning: unused parameter ‘value’ [-Wunused-parameter]
 1332 |                                                      char *value)
      |                                                      ~~~~~~^~~~~

After applying this patch:

[  0%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_user.c.o
[  1%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_client.c.o
[  2%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_filetransfer.c.o
[  2%] Building C object src/lib/CMakeFiles/dlt.dir/dlt_env_ll.c.o
[  3%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_common.c.o
[  4%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_log.c.o
[  4%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_multiple_files.c.o
[  5%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_protocol.c.o
[  6%] Building C object src/lib/CMakeFiles/dlt.dir/__/shared/dlt_user_shared.c.o
[  6%] Linking C shared library libdlt.so
[  6%] Built target dlt
[  6%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt-daemon.c.o
[  7%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_client.c.o
[  8%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_common.c.o
[  8%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_connection.c.o
[  [9](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:10)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_event_handler.c.o
[ [10](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:11)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_offline_logstorage.c.o
[ 10%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_serial.c.o
[ [11](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:12)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_socket.c.o
[ 11%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/dlt_daemon_unix_socket.c.o
[ [12](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:13)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/gateway/dlt_gateway.c.o
[ [13](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:14)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/lib/dlt_client.c.o
[ 13%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_common.c.o
[ [14](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:15)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_config_file_parser.c.o
[ [15](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:16)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_log.c.o
[ 15%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_multiple_files.c.o
[ [16](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:17)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_offline_trace.c.o
[ [17](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:18)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_protocol.c.o
[ 17%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/shared/dlt_user_shared.c.o
[ [18](https://github.com/COVESA/dlt-daemon/actions/runs/13869783310/job/38814963639?pr=736#step:5:19)%] Building C object src/daemon/CMakeFiles/dlt-daemon.dir/__/offlinelogstorage/dlt_offline_logstorage.c.o
/home/runner/work/dlt-daemon/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c: In function ‘dlt_logstorage_check_gzip_compression’:
/home/runner/work/dlt-daemon/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c:1332:60: warning: unused parameter ‘value’ [-Wunused-parameter]
 1332 |                                                      char *value)

@minminlittleshrimp
Copy link
Collaborator Author

This PR is splitted from #732

@minminlittleshrimp
Copy link
Collaborator Author

Hello @lti9hc @Bichdao021195
Kindly review this patch.

@minminlittleshrimp minminlittleshrimp changed the title Refactor legacy code to bypass warning Refactor legacy code to bypass warning - Phase 1 Mar 15, 2025
@minminlittleshrimp minminlittleshrimp self-assigned this Mar 17, 2025
@minminlittleshrimp
Copy link
Collaborator Author

Hello @lti9hc
Please kindly review and merge if no objection/further question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant