Skip to content

Commit

Permalink
Fix: Warnings during build (#1225)
Browse files Browse the repository at this point in the history
* Initial commit

* Fix:#1185

* Fix:#1185

* Update after further tests

* Update navit.c

Missing opening bracket.

* Update navit.c

Needs AND not OR when combining if clauses.

* Revert "Fix:#1185"

This reverts commit fd91e40.

* Revert "Fix:#1185"

This reverts commit be87cd3.

* Fix: Warning during build

* WINCE compiler needs pragma to be outside of a function
  • Loading branch information
OLFDB authored Mar 7, 2023
1 parent 2ac4a84 commit d85f71e
Show file tree
Hide file tree
Showing 9 changed files with 283 additions and 237 deletions.
23 changes: 1 addition & 22 deletions navit/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,7 @@ extern "C" {

enum item_type;

/**
* Attribute type values, created using macro magic.
*/
enum attr_type {
#define ATTR2(x,y) attr_##y=x,
#define ATTR(x) attr_##x,

/* Special macro for unused attribute types. Creates a placeholder entry
* in the enum so the following values do not change. */
#define ATTR_UNUSED ATTR_UNUSED_L(__LINE__)
#define ATTR_UNUSED_L(x) ATTR_UNUSED_WITH_LINE_NUMBER(x)
#define ATTR_UNUSED_WITH_LINE_NUMBER(x) ATTR_UNUSED_##x,

#include "attr_def.h"

#undef ATTR_UNUSED_WITH_LINE_NUMBER
#undef ATTR_UNUSED_L
#undef ATTR_UNUSED

#undef ATTR2
#undef ATTR
};
#include "attr_type_def.h"

enum attr_format {
attr_format_default=0,
Expand Down
37 changes: 37 additions & 0 deletions navit/attr_type_def.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef NAVIT_ATTR_TYPE_DEFH
#define NAVIT_ATTR_TYPE_DEFH

#ifdef __cplusplus
extern "C" {
#endif

/**
* Attribute type values, created using macro magic.
*/
enum attr_type {
#define ATTR2(x,y) attr_##y=x,
#define ATTR(x) attr_##x,

/* Special macro for unused attribute types. Creates a placeholder entry
* in the enum so the following values do not change. */
#define ATTR_UNUSED ATTR_UNUSED_L(__LINE__)
#define ATTR_UNUSED_L(x) ATTR_UNUSED_WITH_LINE_NUMBER(x)
#define ATTR_UNUSED_WITH_LINE_NUMBER(x) ATTR_UNUSED_##x,

#include "attr_def.h"

#undef ATTR_UNUSED_WITH_LINE_NUMBER
#undef ATTR_UNUSED_L
#undef ATTR_UNUSED

#undef ATTR2
#undef ATTR
};

#ifdef __cplusplus
}
/* __cplusplus */
#endif

/* NAVIT_ATTR_TYPE_DEFH */
#endif
5 changes: 4 additions & 1 deletion navit/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ void debug_dump_mallocs(void) {
}
}


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wframe-address" // We know what we are doing here, suppress warning
void *debug_malloc(const char *where, int line, const char *func, int size) {
struct malloc_head *head;
struct malloc_tail *tail;
Expand Down Expand Up @@ -508,7 +511,7 @@ void *debug_malloc(const char *where, int line, const char *func, int size) {
tail->magic=0xdeadbef0;
return head;
}

#pragma GCC diagnostic pop

void *debug_malloc0(const char *where, int line, const char *func, int size) {
void *ret=debug_malloc(where, line, func, size);
Expand Down
9 changes: 1 addition & 8 deletions navit/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ extern "C" {
#endif

#include <stdio.h>

enum item_type {
#define ITEM2(x,y) type_##y=x,
#define ITEM(x) type_##x,
#include "item_def.h"
#undef ITEM2
#undef ITEM
};
#include "item_type_def.h"

#define route_item_first type_street_0
#define route_item_last type_street_parking_lane
Expand Down
22 changes: 22 additions & 0 deletions navit/item_type_def.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef NAVIT_ITEM_TYPE_DEFH
#define NAVIT_ITEM_TYPE_DEFH

#ifdef __cplusplus
extern "C" {
#endif

enum item_type {
#define ITEM2(x,y) type_##y=x,
#define ITEM(x) type_##x,
#include "item_def.h"
#undef ITEM2
#undef ITEM
};

#ifdef __cplusplus
}
/* __cplusplus */
#endif

/* NAVIT_ITEM_TYPE_DEFH */
#endif
Loading

0 comments on commit d85f71e

Please sign in to comment.