Skip to content

Commit

Permalink
Fix compiler flags and address warnings in acap-native-sdk-examples (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-olsson-work authored and pataxis committed Apr 9, 2024
1 parent 96952fb commit 4c02869
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion axoverlay/app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags $(PKGS)
LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs $(PKGS))
LDFLAGS += -s -laxoverlay

CFLAGS-y += -W -Wformat=2 -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Winline -Wdisabled-optimization -Wfloat-equal -Wall -Werror
CFLAGS += -W -Wformat=2 -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Winline -Wdisabled-optimization -Wfloat-equal -Wall -Werror

all: $(PROGS)

Expand Down
40 changes: 30 additions & 10 deletions axoverlay/app/axoverlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,21 @@ setup_palette_color(const int index, const gint r, const gint g, const gint b, c
* param overlay_height Overlay height.
* param user_data Optional user data associated with this overlay.
*/
static void adjustment_cb(const gint id,
const struct axoverlay_stream_data* stream,
static void adjustment_cb(gint id,
struct axoverlay_stream_data* stream,
enum axoverlay_position_type* postype,
gfloat* overlay_x,
gfloat* overlay_y,
gint* overlay_width,
gint* overlay_height,
gpointer user_data) {
/* Silence compiler warnings for unused parameters/arguments */
(void)id;
(void)postype;
(void)overlay_x;
(void)overlay_y;
(void)user_data;

syslog(LOG_INFO, "Adjust callback for overlay: %i x %i", *overlay_width, *overlay_height);
syslog(LOG_INFO, "Adjust callback for stream: %i x %i", stream->width, stream->height);

Expand All @@ -230,14 +237,20 @@ static void adjustment_cb(const gint id,
* param user_data Optional user data associated with this overlay.
*/
static void render_overlay_cb(gpointer rendering_context,
const gint id,
const struct axoverlay_stream_data* stream,
const enum axoverlay_position_type postype,
const gfloat overlay_x,
const gfloat overlay_y,
const gint overlay_width,
const gint overlay_height,
const gpointer user_data) {
gint id,
struct axoverlay_stream_data* stream,
enum axoverlay_position_type postype,
gfloat overlay_x,
gfloat overlay_y,
gint overlay_width,
gint overlay_height,
gpointer user_data) {
/* Silence compiler warnings for unused parameters/arguments */
(void)postype;
(void)user_data;
(void)overlay_x;
(void)overlay_y;

gdouble val = FALSE;

syslog(LOG_INFO, "Render callback for camera: %i", stream->camera);
Expand Down Expand Up @@ -280,6 +293,9 @@ static void render_overlay_cb(gpointer rendering_context,
* param user_data Optional callback user data.
*/
static gboolean update_overlay_cb(gpointer user_data) {
/* Silence compiler warnings for unused parameters/arguments */
(void)user_data;

GError* error = NULL;

// Countdown
Expand Down Expand Up @@ -366,6 +382,10 @@ static gboolean signal_handler_init(void) {
* param argv Arguments vector.
*/
int main(int argc, char** argv) {
/* Silence compiler warnings for unused parameters/arguments */
(void)argc;
(void)argv;

GError* error = NULL;
GError* error_text = NULL;
gint camera_height = 0;
Expand Down
2 changes: 1 addition & 1 deletion hello-world/app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ OBJS1 = $(PROG1).c

PROGS = $(PROG1)

CFLAGS-y = -W -Wformat=2 -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Winline -Wdisabled-optimization -Wfloat-equal -Wall -Werror
CFLAGS = -W -Wformat=2 -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Winline -Wdisabled-optimization -Wfloat-equal -Wall -Werror

all: $(PROGS)

Expand Down
4 changes: 4 additions & 0 deletions hello-world/app/hello_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
* param argv Arguments vector.
*/
int main(int argc, char** argv) {
/* Silence compiler warnings for unused parameters/arguments */
(void)argc;
(void)argv;

/* Open the syslog to report messages for "hello_world" */
openlog("hello_world", LOG_PID | LOG_CONS, LOG_USER);

Expand Down
2 changes: 1 addition & 1 deletion reproducible-package/app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ OBJS1 = $(PROG1).c

PROGS = $(PROG1)

CFLAGS-y = -W -Wformat=2 -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Winline -Wdisabled-optimization -Wfloat-equal -Wall -Werror
CFLAGS = -W -Wformat=2 -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Winline -Wdisabled-optimization -Wfloat-equal -Wall -Werror

# Set to create a reproducible package
DATE_FMT = +%Y-%m-%d
Expand Down
4 changes: 4 additions & 0 deletions reproducible-package/app/reproducible_package.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
* param argv Arguments vector.
*/
int main(int argc, char** argv) {
/* Silence compiler warnings for unused parameters/arguments */
(void)argc;
(void)argv;

/* Open the syslog to report messages for "reproducible_package" */
openlog("reproducible_package", LOG_PID | LOG_CONS, LOG_USER);

Expand Down

0 comments on commit 4c02869

Please sign in to comment.