root/foundation-apps/grosview-maxx/general.h

Revision 2, 3.6 KB (checked in by emasson, 3 years ago)

initial import for the community edition

Line 
1#ifndef General_h
2#define General_h
3
4//  Copyright (c) 1996, 1997-2002 by Brian Grayson (bgrayson@netbsd.org)
5//
6//  This file was written by Brian Grayson for the NetBSD and xosview
7//    projects.
8//  This file may be distributed under terms of the GPL or of the BSD
9//    license, whichever you choose.  The full license notices are
10//    contained in the files COPYING.GPL and COPYING.BSD, which you
11//    should have received.  If not, contact one of the xosview
12//    authors for a copy.
13//
14#define GENERAL_H_CVSID "$Id: general.h,v 1.1.1.1 2008/05/04 15:53:48 emasson Exp $"
15
16  /*  This file should be included by every .cc file, after any system
17      includes but before any local includes.  It should NOT be included
18      by any .h files unless there is a REALLY good reason.  */
19
20#if !defined(__GNUC__) && !defined(__sun)
21  /*  Every GNU system has _G_config.h, I believe, which tells us
22      whether or not the bool define exists.  However, for simplicity,
23      let's just redefine them all.  The following lines are directly
24      from g++-include's bool.h file.  bgrayson */
25  /* eile: The MIPSPro compiler on IRIX does not like the redefinition
26     of 'bool'. Nowadays every c++ compiler should define bool anyway....
27
28#undef FALSE
29#undef false
30#undef TRUE
31#undef true
32enum bool { FALSE = 0, false = 0, TRUE = 1, true = 1 };
33  */
34
35#endif
36
37  /*  Let's add a handy macro for inserting the CVS id string into the
38      .cc (and hence .o) files, so that 'ident' can be used on the
39      executable.  */
40
41  /*  Note:  If your compiler chokes on __attribute__ stuff, add
42      -DNO_ADD_ID_STR to CFLAGS in the Makefile.  gcc handles
43      __attribute__ fine, and both of the primary authors use gcc, so
44      things are a little gcc-biased...  :)  */
45
46  /*  NetBSD note:  In their semi-infinite wisdom, the NetBSD
47      file <sys/cdefs.h> (which is included via a circuitous
48      route by some of the xosview source) automatically
49      redefs __attribute__(x) to be nothing if one is using
50      gcc-2.4.x or earlier.  This could be considered a
51      feature, but in our current particular instance,
52      it hides information if one is using gcc-2.4.5
53      (NetBSD-1.1 and earlier's standard gcc).  Basically, by
54      nullifying __attribute__, gcc says "cvsid defined but not
55      used", whereas if the __attribute__ were left alone,
56      gcc-2.4.5 would say "Ignoring unknown attribute "unused"",
57      followed by "cvsid defined but not used", which to me is much
58      clearer about what is going on.  bgrayson 9/96  */
59
60#if !defined( NO_ADD_ID_STR) && defined(__GNUC__)
61    /*  If it's GNUC, we'll assume it can handle the __attribute__
62        ((unused)) modifier.  Notice that 2.4.5 can parse this, but will
63        not handle ((unused)).  So, for gcc 2.4.5 (and below), set
64        NO_ADD_ID_STR, or live with the warning messages.  */
65    /*  Notice that we need to use a unique-within-the-cpp'd-file
66     *  identifier for the char*'s, hence the definition of
67     *  CVSID_DOT_H2 etc., which are occasionally needed.  */
68  #define CVSID(s) \
69      static char* cvsid __attribute__ ((unused)) = (s)
70  #define CVSID_DOT_H(s) \
71      static char* cvsid_dot_h __attribute__ ((unused)) = (s)
72  #define CVSID_DOT_H2(s) \
73      static char* cvsid_dot_h2 __attribute__ ((unused)) = (s)
74  #define CVSID_DOT_H3(s) \
75      static char* cvsid_dot_h3 __attribute__ ((unused)) = (s)
76#else
77    /*  Don't put the CVS Id strings in the .o files -- the
78        compiler will probably print tons of warning about
79        unused variables if we did.  */
80  #define CVSID(s)
81  #define CVSID_DOT_H(s)
82  #define CVSID_DOT_H2(s)
83  #define CVSID_DOT_H3(s)
84#endif
85
86#endif
Note: See TracBrowser for help on using the browser.