fix gcc build, forward-declare structs in the header.

MSVC allows structs to be declared in a function signature, gcc wants
to know about them earlier.
This commit is contained in:
Enno Rehling 2014-11-01 13:10:22 +01:00
parent 1af315ebf2
commit 27f94783bc
12 changed files with 111 additions and 57 deletions

View File

@ -23,6 +23,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct potion_type;
struct unit;
struct region;
struct item_type;
struct order;
enum { enum {
/* Stufe 1 */ /* Stufe 1 */
P_FAST, P_FAST,

View File

@ -14,10 +14,12 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct lua_State; struct lua_State;
struct selection; struct selection;
struct state; struct state;
struct region; struct region;
struct terrain_type;
int gmmain(int argc, char *argv[]); int gmmain(int argc, char *argv[]);
int curses_readline(struct lua_State *L, char *buffer, size_t size, int curses_readline(struct lua_State *L, char *buffer, size_t size,

View File

@ -25,6 +25,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct attrib;
struct attrib_type;
struct faction;
struct region;
struct storage;
struct unit;
extern int nextborder; extern int nextborder;
typedef struct connection { typedef struct connection {

View File

@ -25,6 +25,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct spell; struct spell;
struct item;
struct unit;
typedef struct itemdata { typedef struct itemdata {
const struct item_type *itype; const struct item_type *itype;

View File

@ -33,6 +33,8 @@ extern "C" {
struct resource_type; struct resource_type;
struct locale; struct locale;
struct troop; struct troop;
struct item;
struct order;
typedef struct item { typedef struct item {
struct item *next; struct item *next;

View File

@ -22,6 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct region;
struct plane;
struct storage;
#define PFL_NOCOORDS 1 /* not in use */ #define PFL_NOCOORDS 1 /* not in use */
#define PFL_NORECRUITS 2 #define PFL_NORECRUITS 2
#define PFL_NOALLIANCES 4 #define PFL_NOALLIANCES 4

View File

@ -22,6 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct unit;
struct resource_type;
struct region;
/* bitfield values for get/use/change operations */ /* bitfield values for get/use/change operations */
#define GET_SLACK 0x01 #define GET_SLACK 0x01
#define GET_RESERVE 0x02 #define GET_RESERVE 0x02

View File

@ -22,6 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct attrib;
struct item;
struct storage;
struct spell;
struct spellbook;
struct unit;
typedef struct gamedata { typedef struct gamedata {
struct storage *store; struct storage *store;
int version; int version;

View File

@ -23,6 +23,13 @@ extern "C" {
#endif #endif
struct castorder; struct castorder;
struct unit;
struct region;
struct spell;
struct spell_component;
struct quicklist;
struct attrib_type;
typedef int (*spell_f)(struct castorder * co); typedef int (*spell_f)(struct castorder * co);
typedef void(*fumble_f)(const struct castorder * co); typedef void(*fumble_f)(const struct castorder * co);

View File

@ -22,7 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
extern int writepasswd(void); struct unit;
struct region;
struct building;
struct faction;
struct order;
struct attrib_type;
int writepasswd(void);
void demographics(void); void demographics(void);
void update_guards(void); void update_guards(void);
void update_subscriptions(void); void update_subscriptions(void);
@ -32,7 +39,7 @@ extern "C" {
bool renamed_building(const struct building * b); bool renamed_building(const struct building * b);
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name); int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
void get_food(struct region * r); void get_food(struct region * r);
extern int can_contact(const struct region *r, const struct unit *u, const struct unit *u2); int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
/* eressea-specific. put somewhere else, please. */ /* eressea-specific. put somewhere else, please. */
void processorders(void); void processorders(void);

View File

@ -26,6 +26,8 @@ extern "C" {
#endif #endif
struct unit; struct unit;
struct region;
struct region_list;
struct ship; struct ship;
struct building_type; struct building_type;

View File

@ -22,10 +22,14 @@ extern "C" {
struct locale; struct locale;
struct message; struct message;
extern struct message *cinfo_ship(const void *obj, objtype_t typ, struct ship;
struct unit;
struct curse;
struct message *cinfo_ship(const void *obj, objtype_t typ,
const struct curse *c, int self); const struct curse *c, int self);
extern void register_shipcurse(void); void register_shipcurse(void);
extern struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage, struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
float power, int duration); float power, int duration);
int levitate_ship(struct ship *sh, struct unit *mage, float power, int levitate_ship(struct ship *sh, struct unit *mage, float power,
int duration); int duration);