forward declarations for struct monst, struct obj

This should eliminate the 'onefile' complaint for objects.c without
breaking anything with any standard conforming compiler.  (Fingers
crossed.)
This commit is contained in:
PatR
2022-09-13 10:27:53 -07:00
parent d0ee89ab68
commit a1e83d1d3a
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -6,6 +6,11 @@
#ifndef MONST_H #ifndef MONST_H
#define MONST_H #define MONST_H
/* start with incomplete types in case these aren't defined yet;
basic pointers to them don't need to know their details */
struct monst;
struct obj;
#ifndef MEXTRA_H #ifndef MEXTRA_H
#include "mextra.h" #include "mextra.h"
#endif #endif
+5
View File
@@ -9,6 +9,11 @@
/* #define obj obj_nh */ /* uncomment for SCO UNIX, which has a conflicting /* #define obj obj_nh */ /* uncomment for SCO UNIX, which has a conflicting
* typedef for "obj" in <sys/types.h> */ * typedef for "obj" in <sys/types.h> */
/* start with incomplete types in case these aren't defined yet;
basic pointers to them don't need to know their details */
struct obj;
struct monst;
union vptrs { union vptrs {
struct obj *v_nexthere; /* floor location lists */ struct obj *v_nexthere; /* floor location lists */
struct obj *v_ocontainer; /* point back to container */ struct obj *v_ocontainer; /* point back to container */
-2
View File
@@ -2,8 +2,6 @@
/* Copyright (c) Mike Threepoint, 1989. */ /* Copyright (c) Mike Threepoint, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
struct monst { struct monst *dummy; }; /* lint: struct obj's union */
#include "config.h" #include "config.h"
#include "obj.h" #include "obj.h"