Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: (PR#2306) config.h for all files
Home

[Freeciv-Dev] Re: (PR#2306) config.h for all files

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2306) config.h for all files
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2002 12:41:03 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, Nov 11, 2002 at 12:31:42PM -0800, Jason Short via RT wrote:
> Attached is a patch to bring #include <config.h> to every source file.
> 
> In addition to the arguments below, there are some practical reasons why 
> this is needed.  Currently config.h #defines 'const', which is used all 
> over the place.  If it changes the definition, right now this will 
> result in changes in only some places, lots of warnings, and (if the 
> definition is necessary) compilation failure.

Mhhh. Can you explain me this:

--- common/netintf.h    2002/02/14 15:17:16     1.4
+++ common/netintf.h    2002/11/13 20:01:58
@@ -18,10 +18,6 @@
   Common network interface.
 ***********************************************************************/

-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif

and how this is supposed to work afterwards? I'm more for running 

  find -name "*.[ch]*"|grep -v /intl/ |grep -v beos|grep -v amiga|grep -v 
mui|python b.py

This lists all files which have a conditional preprocessor statement
and doesn't include config.h. Output (cleaned):

config missing: ./ai/advmilitary.c ['#ifdef DEBUG']
config missing: ./ai/aiunit.c ['#ifdef DEBUG', '#ifdef DEBUG', '#ifdef DEBUG', 
'#ifdef DEBUG', '#ifdef DEBUG']
config missing: ./client/gui-win32/gui_main.h ['#ifndef RC_INVOKED']
config missing: ./client/gui-win32/gui_stuff.c ['#ifdef HAVE_CONFIG_H']
config missing: ./client/gui-xaw/canvas.h ['#ifndef _Canvas_h', '#ifndef 
XtNexposeProc', '#ifndef XtNexposeProcData', '#ifndef\tXtNresizeProc', 
'#ifndef\tXtNresizeProcData', '#ifndef XtNvisual', '#ifndef XtNBackPixmap', 
'#if NeedFunctionPrototypes', '#if NeedFunctionPrototypes']
config missing: ./common/connection.h ['#ifdef HAVE_SYS_TIME_H']
config missing: ./common/game.h ['#ifdef HAVE_SYS_TIME_H', '#ifndef NDEBUG']
config missing: ./common/idex.c ['#ifndef IDEX_DIE']
config missing: ./common/inputfile.c ['#ifdef DEBUG']
config missing: ./common/log.h ['#ifdef DEBUG', '#ifdef DEBUG', '#ifdef 
__GNUC__', '#ifdef DEBUG', '#ifdef DEBUG']
config missing: ./common/map.h ['#ifdef DEBUG']
config missing: ./common/support.h ['#ifdef HAVE_SYS_TYPES_H', '#ifdef 
SOCKET_ZERO_ISNT_STDIN']
config missing: ./common/timing.h ['#ifdef DEBUG']
config missing: ./server/settlers.c ['#ifdef ALLOW_VIRTUAL_BOATS', '#ifdef 
REALLY_DEBUG_THIS', '#ifdef REALLY_DEBUG_THIS', '#ifdef REALLY_DEBUG_THIS', 
'#ifdef REALLY_DEBUG_THIS', '#ifdef AI_SMART']
config missing: ./server/sanitycheck.c ['#ifndef NDEBUG', '#ifndef NDEBUG']
config missing: ./server/stdinhand.h ['#ifdef HAVE_LIBREADLINE', '#ifdef 
HAVE_NEWLIBREADLINE']

So I'm for correcting these. 

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 1 + 1 = 3, for large values of 1

import sys, re

for file in sys.stdin.readlines():
    file=file[:-1]
    a=[]
    con=0
    for line in open(file).readlines():
        line=line[:-1]
        if re.search("^#if",line) and \
           not re.search("^#ifndef FC__[A-Z_]+_H$",line):
            a.append(line)
        if re.search("#include <config.h>",line):
            con=1
    if a and not con:
        print "config missing:",file,a
    if con and not a:
        print "extra config:",file

[Prev in Thread] Current Thread [Next in Thread]