See comment below.

Am 09.08.12 21:19, schrieb Jon Trulson:
> On Thu, 9 Aug 2012, ch...@chriswareham.net wrote:
> 
>> Hi folks,
>>
> 
> Hi, a couple of things: in the future, could you use git format patch
> format for any further patch submissions?  Also, please don't compress
> them, I think most of us can handle 20KB patches :)
> 
> A few other comments:
> 
>> I enabled a bunch of warning flags in the Imake.tmpl file, including -Wall 
>> and
>> -Werror. This failed to bootstrap the build, since there were errors in the
>> config tools. Attached is a patch that makes imake and several of the utility
>> tools build with the following flags:
>>
>> -Wall -Werror -Wno-overlength-strings- -ansi -pedantic
>>
> 
> Won't -Werror cause compilation to fail on all warnings?  There are
> many thousands of them and I'd prefer not to make CDE unbuildable
> until they are all fixed, which could take *a long* time.
> 
>> The overlength strings warning need to be disabled as there's a long string 
>> in
>> imake.c
>>
>> If anyone see any value in it, I am happy to continue cleaning up imake and 
>> the
>> other build tools. If so, then I wonder if it's worth setting a baseline that
>> the systems the code is intended for should provide. For example, ANSI C, a
>> certain level of POSIX compatibility and so on. If so, then I could clean up 
>> a
>> lot of K&R style declarations and ifdef'ed code that copes with systems 
>> without
>> varargs support.
>>
> 
> I definitely see value in this work.  One thing I don't like about
> this patch right off though (aside from -Werror) is your modifications
> to Imake.tmpl, removing CplusplusOptions.  This is the wrong place
> (and wrong way) to do this - this should be done in the various
> vendor.cf files (like linux.cf).  If you look at that file, it should
> be clear how you should do this.
> 
> Also, it looks like many of the changes are formatting changes.  Not
> complaining, just pointing it out.

Actually I am complaining about some of the changes.  At this moment, we
should concentrate on making the code work, not change the source code
style to ones personal taste.

Changing

int<TAB>foo;

to

int<SPACE>foo;

does exactly gain us nothing.

Also I think C should be used with "common-sense" approach:

if (p = getenv()) {}

is a perfectly valid idiom.  No need to change that to if ((p =
getenv())) {}

I could continue with "sizeof" is an operator, not a function; same goes
for return.  That said, braces around return values are not needed (but
are used in CDE all over the place, I know ;), neither are braces needed
around sizeof arguments in most cases (unlike return, there are subtle
differences here)



> 
> That said, I would also like input from others on the list.  I have
> included your patch below, inline, so that others might easily peruse
> it.  I think it's a good way to go moving forward.  As to minimum
> compiler/posix support, that's something else I'd like other opinions
> on.
> 
> I'm all for requiring ANSI compilers as a start, for example :)
> 
> Chris's patch below:
> 
> =-=-=
> diff --git a/cde/config/cf/Imake.tmpl b/cde/config/cf/Imake.tmpl
> index 3338283..908d1a9 100644
> --- a/cde/config/cf/Imake.tmpl
> +++ b/cde/config/cf/Imake.tmpl
> @@ -937,7 +937,7 @@ CXXDEPENDINCLUDES = CplusplusDependIncludes
>    CXXEXTRA_DEFINES = CplusplusExtraDefines
>   CXXEXTRA_INCLUDES = CplusplusExtraIncludes
>      CXXSTD_DEFINES = CplusplusStandardDefines $(CXXPROJECT_DEFINES)
> -       CXXOPTIONS = CplusplusOptions
> +       CXXOPTIONS = -Wall -Werror
>         CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES)
>          CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) 
> $(CXXEXTRA_DEFINES) $(DEFINES)
>            CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) 
> $(CXXDEFINES)
> @@ -1101,7 +1101,7 @@ CXXEXTRA_INCLUDES = CplusplusExtraIncludes
>   # define TopInclude -I$(TOP)
>   #endif
>         CDEBUGFLAGS = DefaultCDebugFlags
> -        CCOPTIONS = DefaultCCOptions /* to distinguish from param flags */
> +        CCOPTIONS = -Wall -Werror -Wno-overlength-strings -ansi -pedantic
>   /*
>    * STD_INCLUDES contains system-specific includes
>    * TOP_INCLUDES specifies how to get to /usr/include or its build substitute
> diff --git a/cde/config/imake/imake.c b/cde/config/imake/imake.c
> index 235d791..a62d7f5 100644
> --- a/cde/config/imake/imake.c
> +++ b/cde/config/imake/imake.c
> @@ -256,6 +256,7 @@ extern int        errno;
>    * are there any X_NOT_STDC_ENV machines left in the world?
>    */
>   #include <string.h>
> +#include <stdarg.h>
>   #include "imakemdep.h"
> 
>   /*
> @@ -315,7 +316,7 @@ typedef   unsigned char   boolean;
> 
>   char *cpp = NULL;
> 
> -char *tmpMakefile    = "/tmp/Imf.XXXXXX";
> +static char *tmpMakefile = "/tmp/Imf.XXXXXX";
>   char        *tmpImakefile    = "/tmp/IIf.XXXXXX";
>   char        *make_argv[ ARGUMENTS ] = {
>   #ifdef WIN32
> @@ -339,9 +340,11 @@ char     *ReadLine();
>   char        *CleanCppInput();
>   char        *Strdup();
>   char        *Emalloc();
> -void LogFatalI(), LogFatal(), LogMsg();
> +void    LogFatal(const char *, ...);
> +void    LogMsg(const char *, ...);
> +void    Log(const char *, va_list);
> 
> -void showit();
> +static void showit(FILE *);
>   void        wrapup();
>   void        init();
>   void        AddMakeArg();
> @@ -350,7 +353,7 @@ void      SetOpts();
>   void        CheckImakefileC();
>   void        cppit();
>   void        makeit();
> -void CleanCppOutput();
> +static void CleanCppOutput(FILE *, const char *);
>   boolean     isempty();
>   void        writetmpfile();
> 
> @@ -400,12 +403,11 @@ main(argc, argv)
>       exit(0);
>   }
> 
> -void
> -showit(fd)
> -     FILE    *fd;
> +static void
> +showit(FILE *fd)
>   {
> -     char    buf[ BUFSIZ ];
> -     int     red;
> +     char buf[BUFSIZ];
> +     int red;
> 
>       fseek(fd, 0, 0);
>       while ((red = fread(buf, 1, BUFSIZ, fd)) > 0)
> @@ -434,7 +436,7 @@ catch(sig)
>       int     sig;
>   {
>       errno = 0;
> -     LogFatalI("Signal %d.", sig);
> +     LogFatal("Signal %d.", sig);
>   }
> 
>   /*
> @@ -457,10 +459,9 @@ init()
>        * the default.  Or if cpp is not the default.  Or if the make
>        * found by the PATH variable is not the default.
>        */
> -     if (p = getenv("IMAKEINCLUDE")) {
> +     if ((p = getenv("IMAKEINCLUDE"))) {
>               if (*p != '-' || *(p+1) != 'I')
> -                     LogFatal("Environment var IMAKEINCLUDE %s",
> -                             "must begin with -I");
> +                     LogFatal("Environment var IMAKEINCLUDE %s must begin 
> with -I");
>               AddCppArg(p);
>               for (; *p; p++)
>                       if (*p == ' ') {
> @@ -468,9 +469,9 @@ init()
>                               AddCppArg(p);
>                       }
>       }
> -     if (p = getenv("IMAKECPP"))
> +     if ((p = getenv("IMAKECPP")))
>               cpp = p;
> -     if (p = getenv("IMAKEMAKE"))
> +     if ((p = getenv("IMAKEMAKE")))
>               make_argv[0] = p;
> 
>       if (signal(SIGINT, SIG_IGN) != SIG_IGN)
> @@ -483,7 +484,7 @@ AddMakeArg(arg)
>   {
>       errno = 0;
>       if (make_argindex >= ARGUMENTS-1)
> -             LogFatal("Out of internal storage.", "");
> +             LogFatal("Out of internal storage.");
>       make_argv[ make_argindex++ ] = arg;
>       make_argv[ make_argindex ] = NULL;
>   }
> @@ -494,7 +495,7 @@ AddCppArg(arg)
>   {
>       errno = 0;
>       if (cpp_argindex >= ARGUMENTS-1)
> -             LogFatal("Out of internal storage.", "");
> +             LogFatal("Out of internal storage.");
>       cpp_argv[ cpp_argindex++ ] = arg;
>       cpp_argv[ cpp_argindex ] = NULL;
>   }
> @@ -523,7 +524,7 @@ SetOpts(argc, argv)
>                   else {
>                       argc--, argv++;
>                       if (! argc)
> -                         LogFatal("No description arg after -f flag", "");
> +                         LogFatal("No description arg after -f flag");
>                       Imakefile = argv[0];
>                   }
>               } else if (argv[0][1] == 's') {
> @@ -533,7 +534,7 @@ SetOpts(argc, argv)
>                   else {
>                       argc--, argv++;
>                       if (!argc)
> -                         LogFatal("No description arg after -s flag", "");
> +                         LogFatal("No description arg after -s flag");
>                       Makefile = ((argv[0][0] == '-') && !argv[0][1]) ?
>                           NULL : argv[0];
>                   }
> @@ -547,7 +548,7 @@ SetOpts(argc, argv)
>                   else {
>                       argc--, argv++;
>                       if (! argc)
> -                         LogFatal("No description arg after -T flag", "");
> +                         LogFatal("No description arg after -T flag");
>                       Template = argv[0];
>                   }
>               } else if (argv[0][1] == 'C') {
> @@ -556,7 +557,7 @@ SetOpts(argc, argv)
>                   else {
>                       argc--, argv++;
>                       if (! argc)
> -                         LogFatal("No imakeCfile arg after -C flag", "");
> +                         LogFatal("No imakeCfile arg after -C flag");
>                       ImakefileC = argv[0];
>                   }
>               } else if (argv[0][1] == 'v') {
> @@ -590,7 +591,7 @@ FindImakefile(Imakefile)
>       } else {
>               if (access("Imakefile", R_OK) < 0)
>                       if (access("imakefile", R_OK) < 0)
> -                             LogFatal("No description file.", "");
> +                             LogFatal("No description file.");
>                       else
>                               Imakefile = "imakefile";
>               else
> @@ -600,43 +601,49 @@ FindImakefile(Imakefile)
>   }
> 
>   void
> -LogFatalI(s, i)
> -     char *s;
> -     int i;
> +LogFatal(const char *s, ...)
>   {
> -     /*NOSTRICT*/
> -     LogFatal(s, (char *)i);
> +    static boolean entered = FALSE;
> +    va_list args;
> +
> +    if (entered)
> +        return;
> +
> +    entered = TRUE;
> +
> +    va_start(args, s);
> +    Log(s, args);
> +    va_end(args);
> +
> +    fprintf(stderr, "Stop.\n");
> +
> +    wrapup();
> +
> +    exit(1);
>   }
> 
>   void
> -LogFatal(x0,x1)
> -     char *x0, *x1;
> +LogMsg(const char *s, ...)
>   {
> -     static boolean  entered = FALSE;
> -
> -     if (entered)
> -             return;
> -     entered = TRUE;
> +    va_list args;
> 
> -     LogMsg(x0, x1);
> -     fprintf(stderr, "  Stop.\n");
> -     wrapup();
> -     exit(1);
> +    va_start(args, s);
> +    Log(s, args);
> +    va_end(args);
>   }
> 
>   void
> -LogMsg(x0,x1)
> -     char *x0, *x1;
> +Log(const char *s, va_list args)
>   {
> -     int error_number = errno;
> +    int error_number = errno;
> 
> -     if (error_number) {
> -             fprintf(stderr, "%s: ", program);
> -             fprintf(stderr, "%s\n", strerror(error_number));
> -     }
> -     fprintf(stderr, "%s: ", program);
> -     fprintf(stderr, x0, x1);
> -     fprintf(stderr, "\n");
> +    if (error_number) {
> +        fprintf(stderr, "%s: ", program);
> +        fprintf(stderr, "%s\n", strerror(error_number));
> +    }
> +    fprintf(stderr, "%s: ", program);
> +    vfprintf(stderr, s, args);
> +    fprintf(stderr, "\n");
>   }
> 
>   void
> @@ -712,18 +719,18 @@ doit(outfd, cmd, argv)
>       if (status < 0)
>               LogFatal("Cannot spawn %s.", cmd);
>       if (status > 0)
> -             LogFatalI("Exit code %d.", status);
> +             LogFatal("Exit code %d.", status);
>   #else
>       pid = fork();
>       if (pid < 0)
> -             LogFatal("Cannot fork.", "");
> +             LogFatal("Cannot fork.");
>       if (pid) {      /* parent... simply wait */
>               while (wait(&status) > 0) {
>                       errno = 0;
>                       if (WIFSIGNALED(status))
> -                             LogFatalI("Signal %d.", waitSig(status));
> +                             LogFatal("Signal %d.", waitSig(status));
>                       if (WIFEXITED(status) && waitCode(status))
> -                             LogFatalI("Exit code %d.", waitCode(status));
> +                             LogFatal("Exit code %d.", waitCode(status));
>               }
>       }
>       else {  /* child... dup and exec cmd */
> @@ -800,7 +807,7 @@ parse_utsname(name, fmt, result, msg)
> 
>     /* Just in case... */
>     if (strlen(buf) >= sizeof(buf))
> -    LogFatal("Buffer overflow parsing uname.", "");
> +    LogFatal("Buffer overflow parsing uname.");
> 
>     /* Parse the buffer.  The sscanf() return value is rarely correct. */
>     *result = '\0';
> @@ -1117,7 +1124,7 @@ define_os_defaults(inFile)
> 
>       /* Obtain the system information. */
>       if (uname(&name) < 0)
> -             LogFatal("Cannot invoke uname", "");
> +             LogFatal("Cannot invoke uname");
> 
>   # ifdef DEFAULT_OS_NAME
>       parse_utsname(&name, DEFAULT_OS_NAME, buf, 
> @@ -1299,14 +1306,12 @@ CleanCppInput(imakefile)
>   }
> 
>   void
> -CleanCppOutput(tmpfd, tmpfname)
> -     FILE    *tmpfd;
> -     char    *tmpfname;
> +CleanCppOutput(FILE *tmpfd, const char *tmpfname)
>   {
> -     char    *input;
> -     int     blankline = 0;
> +     char *input;
> +     int blankline = 0;
> 
> -     while(input = ReadLine(tmpfd, tmpfname)) {
> +     while ((input = ReadLine(tmpfd, tmpfname))) {
>               if (isempty(input)) {
>                       if (blankline++)
>                               continue;
> @@ -1444,7 +1449,7 @@ ReadLine(tmpfd, tmpfname)
>                       tmpfd = freopen(tmpfname, "w+", fp);
>   #endif
>               if (! tmpfd)
> -                     LogFatal("cannot reopen %s\n", tmpfname);
> +                     LogFatal("cannot reopen %s.", tmpfname);
>   #else       /* !SYSV */
>               ftruncate(fileno(tmpfd), (off_t) 0);
>   #endif      /* !SYSV */
> @@ -1499,7 +1504,7 @@ Emalloc(size)
>       char    *p;
> 
>       if ((p = malloc(size)) == NULL)
> -             LogFatalI("Cannot allocate %d bytes", size);
> +             LogFatal("Cannot allocate %d bytes.", size);
>       return(p);
>   }
> 
> diff --git a/cde/config/util/lndir.c b/cde/config/util/lndir.c
> index 4e678ae..49b05a8 100644
> --- a/cde/config/util/lndir.c
> +++ b/cde/config/util/lndir.c
> @@ -87,11 +87,9 @@ in this Software without prior written authorization from 
> The Open Group.
>   #define MAXPATHLEN 2048
>   #endif
> 
> -#if NeedVarargsPrototypes
> -#include <stdarg.h>
> -#endif
> -
> -#ifdef X_NOT_STDC_ENV
> +#ifndef X_NOT_STDC_ENV
> +#include <stdlib.h>
> +#else
>   extern int errno;
>   #endif
>   int silent = 0;                     /* -silent */
> @@ -100,64 +98,45 @@ int ignore_links = 0;            /* -ignorelinks */
>   char *rcurdir;
>   char *curdir;
> 
> -void
> -quit (
> -#if NeedVarargsPrototypes
> -    int code, char * fmt, ...)
> -#else
> -    code, fmt, a1, a2, a3)
> -    char *fmt;
> -#endif
> +static void
> +quit(int code, const char *fmt, const char *str)
>   {
> -#if NeedVarargsPrototypes
> -    va_list args;
> -    va_start(args, fmt);
> -    vfprintf (stderr, fmt, args);
> -    va_end(args);
> -#else
> -    fprintf (stderr, fmt, a1, a2, a3);
> -#endif
> -    putc ('\n', stderr);
> -    exit (code);
> +    fprintf(stderr, fmt, str);
> +    fputc('\n', stderr);
> +    exit(code);
>   }
> 
> -void
> -quiterr (code, s)
> -    char *s;
> +static void
> +quiterr(int code, const char *s)
>   {
> -    perror (s);
> -    exit (code);
> +    perror(s);
> +    exit(code);
>   }
> 
> -void
> -msg (
> -#if NeedVarargsPrototypes
> -    char * fmt, ...)
> -#else
> -    fmt, a1, a2, a3)
> -    char *fmt;
> -#endif
> +static void
> +msg(const char* fmt, const char *str)
>   {
> -#if NeedVarargsPrototypes
> -    va_list args;
> -#endif
>       if (curdir) {
> -     fprintf (stderr, "%s:\n", curdir);
> -     curdir = 0;
> +        fprintf (stderr, "%s:\n", curdir);
> +        curdir = NULL;
>       }
> -#if NeedVarargsPrototypes
> -    va_start(args, fmt);
> -    vfprintf (stderr, fmt, args);
> -    va_end(args);
> -#else
> -    fprintf (stderr, fmt, a1, a2, a3);
> -#endif
> -    putc ('\n', stderr);
> +    fprintf (stderr, fmt, str);
> +    fputc('\n', stderr);
>   }
> 
> -void
> -mperror (s)
> -    char *s;
> +static void
> +msg2(const char* fmt, const char *str1, const char *str2)
> +{
> +    if (curdir) {
> +        fprintf (stderr, "%s:\n", curdir);
> +        curdir = NULL;
> +    }
> +    fprintf (stderr, fmt, str1, str2);
> +    fputc('\n', stderr);
> +}
> +
> +static void
> +mperror(const char *s)
>   {
>       if (curdir) {
>       fprintf (stderr, "%s:\n", curdir);
> @@ -167,9 +146,8 @@ mperror (s)
>   }
> 
> 
> -int equivalent(lname, rname)
> -    char *lname;
> -    char *rname;
> +static int
> +equivalent(char *lname, const char *rname)
>   {
>       char *s;
> 
> @@ -183,14 +161,18 @@ int equivalent(lname, rname)
>   }
> 
> 
> -/* Recursively create symbolic links from the current directory to the "from"
> -   directory.  Assumes that files described by fs and ts are directories. */
> +/*
> + * Recursively create symbolic links from the current directory to the "from"
> + * directory.  Assumes that files described by fs and ts are directories.
> + *
> + * fn: name of "from" directory, either absolute or relative to cwd
> + * fs: stats for the "from" directory
> + * ts: stats for the cwd directory
> + * rel: if true, prepend "../" to fn before using
> + */
> 
> -dodir (fn, fs, ts, rel)
> -char *fn;                    /* name of "from" directory, either absolute or
> -                                relative to cwd */
> -struct stat *fs, *ts;                /* stats for the "from" directory and 
> cwd */
> -int rel;                     /* if true, prepend "../" to fn before using */
> +static int
> +dodir (const char *fn, struct stat *fs, struct stat *ts, int rel)
>   {
>       DIR *df;
>       struct dirent *dp;
> @@ -222,7 +204,7 @@ int rel;                  /* if true, prepend "../" to fn 
> before using */
>       p = buf + strlen (buf);
>       *p++ = '/';
>       n_dirs = fs->st_nlink;
> -    while (dp = readdir (df)) {
> +    while ((dp = readdir (df))) {
>       if (dp->d_name[strlen(dp->d_name) - 1] == '~')
>           continue;
>       strcpy (p, dp->d_name);
> @@ -302,7 +284,7 @@ int rel;                  /* if true, prepend "../" to fn 
> before using */
>       if (symlen >= 0) {
>           /* Link exists in new tree.  Print message if it doesn't match. */
>           if (!equivalent (basesymlen>=0 ? basesym : buf, symbuf))
> -             msg ("%s: %s", dp->d_name, symbuf);
> +             msg2 ("%s: %s", dp->d_name, symbuf);
>       } else {
>           if (symlink (basesymlen>=0 ? basesym : buf, dp->d_name) < 0)
>               mperror (dp->d_name);
> @@ -314,34 +296,33 @@ int rel;                        /* if true, prepend 
> "../" to fn before using */
>   }
> 
> 
> -main (ac, av)
> -int ac;
> -char **av;
> +int
> +main (int argc, char *argv[])
>   {
> -    char *prog_name = av[0];
> +    char *prog_name = argv[0];
>       char *fn, *tn;
>       struct stat fs, ts;
> 
> -    while (++av, --ac) {
> -     if (strcmp(*av, "-silent") == 0)
> +    while (++argv, --argc) {
> +     if (strcmp(*argv, "-silent") == 0)
>           silent = 1;
> -     else if (strcmp(*av, "-ignorelinks") == 0)
> +     else if (strcmp(*argv, "-ignorelinks") == 0)
>           ignore_links = 1;
> -     else if (strcmp(*av, "--") == 0) {
> -         ++av, --ac;
> +     else if (strcmp(*argv, "--") == 0) {
> +         ++argv, --argc;
>           break;
>       }
>       else
>           break;
>       }
> 
> -    if (ac < 1 || ac > 2)
> +    if (argc < 1 || argc > 2)
>       quit (1, "usage: %s [-silent] [-ignorelinks] fromdir [todir]",
>             prog_name);
> 
> -    fn = av[0];
> -    if (ac == 2)
> -     tn = av[1];
> +    fn = argv[0];
> +    if (argc == 2)
> +     tn = argv[1];
>       else
>       tn = ".";
> 
> @@ -367,5 +348,5 @@ char **av;
>   #endif
>       quit (2, "%s: Not a directory", fn);
> 
> -    exit (dodir (fn, &fs, &ts, 0));
> +    return dodir (fn, &fs, &ts, 0);
>   }
> diff --git a/cde/config/util/makestrs.c b/cde/config/util/makestrs.c
> index 62a1c4f..adaec71 100644
> --- a/cde/config/util/makestrs.c
> +++ b/cde/config/util/makestrs.c
> @@ -102,9 +102,7 @@ static char* externdefstr;
> 
>   #define X_MAGIC_STRING "<<<STRING_TABLE_GOES_HERE>>>"
> 
> -static void WriteHeaderProlog (f, phile)
> -    FILE* f;
> -    File* phile;
> +static void WriteHeaderProlog(FILE *f, File *phile)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -125,9 +123,7 @@ static void WriteHeaderProlog (f, phile)
>       (void) fprintf (f, "%s", "#else\n");
>   }
> 
> -static void IntelABIWriteHeader (f, phile)
> -    FILE* f;
> -    File* phile;
> +static void IntelABIWriteHeader(FILE *f, File *phile)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -146,9 +142,7 @@ static void IntelABIWriteHeader (f, phile)
>       (void) fprintf (f, "#endif /* %s */\n", featurestr);
>   }
> 
> -static void SPARCABIWriteHeader (f, phile)
> -    FILE* f;
> -    File* phile;
> +static void SPARCABIWriteHeader(FILE *f, File *phile)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -159,9 +153,7 @@ static void SPARCABIWriteHeader (f, phile)
>                           prefixstr, te->left, te->right);
>   }
> 
> -static void FunctionWriteHeader (f, phile)
> -    FILE* f;
> -    File* phile;
> +static void FunctionWriteHeader(FILE *f, File *phile)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -182,9 +174,7 @@ static void FunctionWriteHeader (f, phile)
>       (void) fprintf (f, "#endif /* %s */\n", featurestr);
>   }
> 
> -static void ArrayperWriteHeader (f, phile)
> -    FILE* f;
> -    File* phile;
> +static void ArrayperWriteHeader(FILE *f, File *phile)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -202,9 +192,7 @@ static void ArrayperWriteHeader (f, phile)
>       (void) fprintf (f, "#endif /* %s */\n", featurestr);
>   }
> 
> -static void DefaultWriteHeader (f, phile)
> -    FILE* f;
> -    File* phile;
> +static void DefaultWriteHeader(FILE *f, File *phile)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -225,9 +213,7 @@ static void DefaultWriteHeader (f, phile)
>       (void) fprintf (f, "#endif /* %s */\n", featurestr);
>   }
> 
> -static void CopyTmplProlog (tmpl, f)
> -    FILE* tmpl;
> -    FILE* f;
> +static void CopyTmplProlog(FILE *tmpl, FILE *f)
>   {
>       char buf[1024];
>       static char* magic_string = X_MAGIC_STRING;
> @@ -241,9 +227,7 @@ static void CopyTmplProlog (tmpl, f)
>       }
>   }
> 
> -static void CopyTmplEpilog (tmpl, f)
> -    FILE* tmpl;
> -    FILE* f;
> +static void CopyTmplEpilog(FILE *tmpl, FILE *f)
>   {
>       char buf[1024];
> 
> @@ -254,15 +238,10 @@ static void CopyTmplEpilog (tmpl, f)
>   static char* abistring[] = {
>       "Default", "Array per string", "Intel", "Intel BC", "SPARC", "Function" 
> };
> 
> -static void WriteHeader (tagline, phile, abi)
> -    char* tagline;
> -    File* phile;
> -    int abi;
> +static void WriteHeader(const char *tagline, File *phile, int abi)
>   {
>       FILE* f;
>       char* tmp;
> -    Table* t;
> -    TableEnt* te;
>       static void (*headerproc[])() = {
>       DefaultWriteHeader, ArrayperWriteHeader,
>       IntelABIWriteHeader, IntelABIWriteHeader,
> @@ -302,9 +281,7 @@ static void WriteHeader (tagline, phile, abi)
>       (void) fclose (f);
>   }
> 
> -static void WriteSourceLine (te, abi, fudge)
> -    TableEnt* te;
> -    int abi;
> +static void WriteSourceLine(TableEnt *te, int abi, int fudge)
>   {
>       char* c;
> 
> @@ -316,8 +293,7 @@ static void WriteSourceLine (te, abi, fudge)
> 
>   static char* const_string = "%s %sConst char %s[] = {\n";
> 
> -static void IntelABIWriteSource (abi)
> -    int abi;
> +static void IntelABIWriteSource(int abi)
>   {
>       File* phile;
> 
> @@ -335,8 +311,7 @@ static void IntelABIWriteSource (abi)
>       }
>   }
> 
> -static void IntelABIBCWriteSource (abi)
> -    int abi;
> +static void IntelABIBCWriteSource(int abi)
>   {
>       File* phile;
> 
> @@ -363,8 +338,7 @@ static void IntelABIBCWriteSource (abi)
>       }
>   }
> 
> -static void FunctionWriteSource (abi)
> -    int abi;
> +static void FunctionWriteSource(int abi)
>   {
>       File* phile;
> 
> @@ -386,8 +360,7 @@ static void FunctionWriteSource (abi)
>       }
>   }
> 
> -static void ArrayperWriteSource (abi)
> -    int abi;
> +static void ArrayperWriteSource(int abi)
>   {
>       File* phile;
>       static int done_atom;
> @@ -403,14 +376,13 @@ static void ArrayperWriteSource (abi)
>                   done_atom = 1;
>               }
>               (void) printf ("%s %sConst char %s%s[] = \"%s\";\n",
> -                            externdefstr, conststr ? conststr : prefixstr, 
> +                            externdefstr, conststr ? conststr : prefixstr, 
> prefixstr,
>                              te->left, te->right);
>           }
>       }
>   }
> 
> -static void DefaultWriteSource (abi)
> -    int abi;
> +static void DefaultWriteSource(int abi)
>   {
>       File* phile;
> 
> @@ -428,9 +400,7 @@ static void DefaultWriteSource (abi)
>       }
>   }
> 
> -static void WriteSource(tagline, abi)
> -    char* tagline;
> -    int abi;
> +static void WriteSource(const char *tagline, int abi)
>   {
>       static void (*sourceproc[])() = {
>       DefaultWriteSource, ArrayperWriteSource,
> @@ -464,8 +434,7 @@ static void WriteSource(tagline, abi)
>       if (tmpl) CopyTmplEpilog (tmpl, stdout);
>   }
> 
> -static void DoLine(buf)
> -    char* buf;
> +static void DoLine(char *buf)
>   {
>   #define X_NO_TOKEN 0
>   #define X_FILE_TOKEN 1
> @@ -596,7 +565,7 @@ static void DoLine(buf)
>           int rlen;
>           int len;
> 
> -         if (right = index(buf, ' '))
> +         if ((right = index(buf, ' ')))
>               *right++ = 0;
>           else
>               right = buf + 1;
> @@ -629,8 +598,7 @@ static void DoLine(buf)
>       }
>   }
> 
> -static void IntelABIIndexEntries (file)
> -    File* file;
> +static void IntelABIIndexEntries(File *file)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -643,8 +611,7 @@ static void IntelABIIndexEntries (file)
>       }
>   }
> 
> -static void DefaultIndexEntries (file)
> -    File* file;
> +static void DefaultIndexEntries(File *file)
>   {
>       Table* t;
>       TableEnt* te;
> @@ -658,9 +625,7 @@ static void DefaultIndexEntries (file)
>       }
>   }
> 
> -static void IndexEntries (file,abi)
> -    File* file;
> -    int abi;
> +static void IndexEntries(File *file, int abi)
>   {
>       switch (abi) {
>       case X_SPARC_ABI:
> @@ -675,8 +640,7 @@ static void IndexEntries (file,abi)
>       }
>   }
> 
> -static char* DoComment (line)
> -    char* line;
> +static char* DoComment(const char *line)
>   {
>       char* tag;
>       char* eol;
> @@ -694,9 +658,7 @@ static char* DoComment (line)
>       return ret;
>   }
> 
> -int main(argc, argv)
> -    int argc;
> -    char** argv;
> +int main(int argc, char *argv[])
>   {
>       int len, i;
>       char* tagline = NULL;
> @@ -755,4 +717,3 @@ int main(argc, argv)
>       WriteSource(tagline, abi);
>       return 0;
>   }
> -
> 
> =-=-=
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to