Build more code in CI (#725)
* bugfix/hostnport: Fix bacnet_fdt_entry_from_ascii() parse wrong * apps/router: Fix Wstrict-prototypes compiler warnings * apps/router: Fix -Wmissing-field-initializers compiler warning * ports/linux: Fix -Wself-assign compiler warning * ports/linux: Fix -Wunused-function compiler warning * Fix -Wimplicit-function-declaration warnings * ci: Add more compile options to enable more code build * ci: Do not fail-fast our main matrix build * cmake: Add -Wno-c99-extensions compiler option --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com> Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -17,6 +17,7 @@ jobs:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macOS-latest]
|
||||
project: [root, test]
|
||||
@@ -28,6 +29,13 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Dependencies (Ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.project == 'root'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# apps/router needs libconfig-dev.
|
||||
sudo apt-get install -y libconfig-dev
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
@@ -48,11 +56,38 @@ jobs:
|
||||
source_dir=$GITHUB_WORKSPACE
|
||||
fi
|
||||
|
||||
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||
cmake $source_dir -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
else
|
||||
cmake $source_dir -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="-Werror"
|
||||
c_flags=""
|
||||
if [[ "$RUNNER_OS" != "Windows" ]]; then
|
||||
# Warnings as errors.
|
||||
c_flags="$c_flags -Werror"
|
||||
fi
|
||||
|
||||
# Compile as much as possible to at least compile test code.
|
||||
c_flags="$c_flags -DBACFILE=ON"
|
||||
c_flags="$c_flags -DPRINT_ENABLED=1"
|
||||
c_flags="$c_flags -DBACNET_TIME_MASTER=ON"
|
||||
c_flags="$c_flags -DBACAPP_COLOR_RGB_CONVERSION_ENABLED=ON"
|
||||
cmake_options="-DCMAKE_C_FLAGS=$c_flags"
|
||||
|
||||
# TODO: Add BACDL_BIP6=ON when it builds withous errors.
|
||||
cmake_options="$cmake_options -DBACDL_BIP=ON"
|
||||
cmake_options="$cmake_options -DBACNET_PROTOCOL_REVISION=24"
|
||||
|
||||
if [[ "$RUNNER_OS" != "macOS" ]]; then
|
||||
# Apple does not have port yet for this.
|
||||
cmake_options="$cmake_options -DBACDL_MSTP=ON"
|
||||
fi
|
||||
|
||||
if [[ "$RUNNER_OS" == "Linux" ]]; then
|
||||
# Apple nor Windows does not have port yet for this.
|
||||
cmake_options="$cmake_options -DBACDL_ARCNET=ON"
|
||||
|
||||
# Currently Windows fails because of pcab.h not found.
|
||||
# Apple does not have port yet for this.
|
||||
cmake_options="$cmake_options -DBACDL_ETHERNET=ON"
|
||||
fi
|
||||
|
||||
cmake $source_dir -DCMAKE_BUILD_TYPE=$BUILD_TYPE $cmake_options
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
|
||||
+1
-1
@@ -765,7 +765,7 @@ if(BACNET_STACK_BUILD_APPS)
|
||||
add_executable(reinit apps/reinit/main.c)
|
||||
target_link_libraries(reinit PRIVATE ${PROJECT_NAME})
|
||||
|
||||
if(BACDL_MSTP)
|
||||
if(BACDL_MSTP AND NOT WIN32)
|
||||
add_executable(
|
||||
router
|
||||
apps/router/ipmodule.c
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "bacnet/basic/sys/keylist.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/bip.h"
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
#include "bacepics.h"
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/bvlc.h"
|
||||
#include "bacnet/datalink/bip.h"
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
/* some demo stuff needed */
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/bvlc.h"
|
||||
#include "bacnet/datalink/bip.h"
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
/* some demo stuff needed */
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
|
||||
+10
-10
@@ -41,7 +41,7 @@ ROUTER_PORT *head = NULL; /* pointer to list of router ports */
|
||||
|
||||
int port_count;
|
||||
|
||||
void print_help();
|
||||
void print_help(void);
|
||||
|
||||
bool read_config(char *filepath);
|
||||
|
||||
@@ -49,17 +49,17 @@ bool parse_cmd(int argc, char *argv[]);
|
||||
|
||||
void init_port_threads(ROUTER_PORT *port_list);
|
||||
|
||||
bool init_router();
|
||||
bool init_router(void);
|
||||
|
||||
void cleanup();
|
||||
void cleanup(void);
|
||||
|
||||
void print_msg(BACMSG *msg);
|
||||
|
||||
uint16_t process_msg(BACMSG *msg, MSG_DATA *data, uint8_t **buff);
|
||||
|
||||
uint16_t get_next_free_dnet();
|
||||
uint16_t get_next_free_dnet(void);
|
||||
|
||||
int kbhit();
|
||||
int kbhit(void);
|
||||
|
||||
inline bool is_network_msg(BACMSG *msg);
|
||||
|
||||
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_help()
|
||||
void print_help(void)
|
||||
{
|
||||
printf(
|
||||
"Usage: router <init_method> [init_parameters]\n"
|
||||
@@ -649,7 +649,7 @@ void init_port_threads(ROUTER_PORT *port_list)
|
||||
}
|
||||
}
|
||||
|
||||
bool init_router()
|
||||
bool init_router(void)
|
||||
{
|
||||
MSGBOX_ID msgboxid;
|
||||
ROUTER_PORT *port;
|
||||
@@ -687,7 +687,7 @@ bool init_router()
|
||||
return true;
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
void cleanup(void)
|
||||
{
|
||||
ROUTER_PORT *port;
|
||||
BACMSG msg;
|
||||
@@ -801,7 +801,7 @@ uint16_t process_msg(BACMSG *msg, MSG_DATA *data, uint8_t **buff)
|
||||
return buff_len;
|
||||
}
|
||||
|
||||
int kbhit()
|
||||
int kbhit(void)
|
||||
{
|
||||
static const int STDIN = 0;
|
||||
static bool initialized = false;
|
||||
@@ -831,7 +831,7 @@ bool is_network_msg(BACMSG *msg)
|
||||
return control_byte & 0x80; /* check 7th bit */
|
||||
}
|
||||
|
||||
uint16_t get_next_free_dnet()
|
||||
uint16_t get_next_free_dnet(void)
|
||||
{
|
||||
ROUTER_PORT *port = head;
|
||||
uint16_t i = 1;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
pthread_mutex_t msg_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
MSGBOX_ID create_msgbox()
|
||||
MSGBOX_ID create_msgbox(void)
|
||||
{
|
||||
MSGBOX_ID msgboxid;
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ typedef struct _msg_data {
|
||||
uint8_t ref_count;
|
||||
} MSG_DATA;
|
||||
|
||||
MSGBOX_ID create_msgbox(
|
||||
);
|
||||
MSGBOX_ID create_msgbox(void);
|
||||
|
||||
/* returns sent byte count */
|
||||
bool send_to_msgbox(
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
void *dl_mstp_thread(void *pArgs)
|
||||
{
|
||||
ROUTER_PORT *port = (ROUTER_PORT *)pArgs;
|
||||
struct mstp_port_struct_t mstp_port = { (MSTP_RECEIVE_STATE)0 };
|
||||
struct mstp_port_struct_t mstp_port = { 0 };
|
||||
volatile SHARED_MSTP_DATA shared_port_data = { 0 };
|
||||
uint16_t pdu_len;
|
||||
uint8_t shutdown = 0;
|
||||
|
||||
@@ -426,8 +426,9 @@ static bool dlmstp_compare_data_expecting_reply(
|
||||
struct DER_compare_t reply;
|
||||
|
||||
/* unused parameters */
|
||||
request_pdu_len = request_pdu_len;
|
||||
reply_pdu_len = reply_pdu_len;
|
||||
(void)request_pdu_len;
|
||||
(void)reply_pdu_len;
|
||||
|
||||
/* decode the request data */
|
||||
request.address.mac[0] = src_address;
|
||||
request.address.mac_len = 1;
|
||||
|
||||
@@ -408,8 +408,9 @@ static bool dlmstp_compare_data_expecting_reply(
|
||||
struct DER_compare_t reply;
|
||||
|
||||
/* unused parameters */
|
||||
request_pdu_len = request_pdu_len;
|
||||
reply_pdu_len = reply_pdu_len;
|
||||
(void)request_pdu_len;
|
||||
(void)reply_pdu_len;
|
||||
|
||||
/* decode the request data */
|
||||
request.address.mac[0] = src_address;
|
||||
request.address.mac_len = 1;
|
||||
@@ -857,5 +858,10 @@ bool dlmstp_init(void *poPort, char *ifname)
|
||||
fprintf(stderr, "Failed to start Master Node FSM task\n");
|
||||
}
|
||||
|
||||
/* You can try also this for thread. This here so we ignore
|
||||
* -Wunused-function compiler warning
|
||||
*/
|
||||
dlmstp_receive_fsm_task(NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#if defined(BACDL_BIP)
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
#endif
|
||||
|
||||
#if PRINT_ENABLED
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
#include "bacnet/rp.h" /* ReadProperty handling */
|
||||
#include "bacnet/dcc.h" /* DeviceCommunicationControl handling */
|
||||
#include "bacnet/version.h"
|
||||
#if defined(BACDL_MSTP)
|
||||
#include "bacnet/datalink/dlmstp.h"
|
||||
#endif
|
||||
#include "bacnet/basic/object/device.h" /* me */
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
/* include the device object */
|
||||
#include "bacnet/basic/object/device.h"
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#if defined(BACDL_BIP)
|
||||
#include "bacnet/datalink/bip.h"
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
#endif
|
||||
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
#include "bacnet/basic/object/netport.h"
|
||||
#endif
|
||||
|
||||
@@ -1055,8 +1055,8 @@ bool bacnet_fdt_entry_from_ascii(BACNET_FDT_ENTRY *value, const char *argv)
|
||||
value->time_to_live = (uint16_t)ttl;
|
||||
value->remaining_time_to_live = (uint16_t)rttl;
|
||||
}
|
||||
address[4] = (uint8_t)p >> 8;
|
||||
address[5] = (uint8_t)p & 0xFF;
|
||||
address[4] = (uint8_t)((p >> 8) & 0xFF);
|
||||
address[5] = (uint8_t)((p >> 0) & 0xFF);
|
||||
octetstring_init(&value->bacnetip_address, address, 6);
|
||||
status = true;
|
||||
} else {
|
||||
@@ -1099,8 +1099,8 @@ bool bacnet_fdt_entry_from_ascii(BACNET_FDT_ENTRY *value, const char *argv)
|
||||
value->time_to_live = (uint16_t)ttl;
|
||||
value->remaining_time_to_live = (uint16_t)rttl;
|
||||
}
|
||||
address[16] = (uint8_t)p >> 8;
|
||||
address[17] = (uint8_t)p & 0xFF;
|
||||
address[16] = (uint8_t)((p >> 8) & 0xFF);
|
||||
address[17] = (uint8_t)((p >> 0) & 0xFF);
|
||||
octetstring_init(&value->bacnetip_address, address, 18);
|
||||
status = true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user