/ Check-in [76b18b2b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix compiler warnings in lemon by removing some of the code added by Ryan Gordon in [1e8b842039cc0].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 76b18b2be072b9ea242df4c9535059f7b43f564b
User & Date: drh 2011-06-20 18:27:23
Context
2011-06-20
19:00
More compiler warning fixes. check-in: ed2dda93 user: drh tags: trunk
18:27
Fix compiler warnings in lemon by removing some of the code added by Ryan Gordon in [1e8b842039cc0]. check-in: 76b18b2b user: drh tags: trunk
18:00
Rework the autoconf script to better deal with utime() and dlopen(). check-in: f69ed286 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/lemon.c.

    37     37   #ifdef TEST
    38     38   #define MAXRHS 5       /* Set low to exercise exception code */
    39     39   #else
    40     40   #define MAXRHS 1000
    41     41   #endif
    42     42   
    43     43   static int showPrecedenceConflict = 0;
    44         -static const char **made_files = NULL;
    45         -static int made_files_count = 0;
    46         -static int successful_exit = 0;
    47         -static void LemonAtExit(void)
    48         -{
    49         -    /* if we failed, delete (most) files we made, to unconfuse build tools. */
    50         -    int i;
    51         -    for (i = 0; i < made_files_count; i++) {
    52         -        if (!successful_exit) {
    53         -            remove(made_files[i]);
    54         -        }
    55         -    }
    56         -    free(made_files);
    57         -    made_files_count = 0;
    58         -    made_files = NULL;
    59         -}
    60         -
    61     44   static char *msort(char*,char**,int(*)(const char*,const char*));
    62     45   
    63     46   /*
    64     47   ** Compilers are getting increasingly pedantic about type conversions
    65     48   ** as C evolves ever closer to Ada....  To work around the latest problems
    66     49   ** we have to define the following variant of strlen().
    67     50   */
................................................................................
  1429   1412       {OPT_FLAG, "x", (char*)&version, "Print the version number."},
  1430   1413       {OPT_FLAG,0,0,0}
  1431   1414     };
  1432   1415     int i;
  1433   1416     int exitcode;
  1434   1417     struct lemon lem;
  1435   1418   
  1436         -  atexit(LemonAtExit);
  1437         -
  1438   1419     OptInit(argv,options,stderr);
  1439   1420     if( version ){
  1440   1421        printf("Lemon version 1.0\n");
  1441   1422        exit(0); 
  1442   1423     }
  1443   1424     if( OptNArgs()!=1 ){
  1444   1425       fprintf(stderr,"Exactly one filename argument is required.\n");
................................................................................
  1533   1514     }
  1534   1515     if( lem.nconflict > 0 ){
  1535   1516       fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict);
  1536   1517     }
  1537   1518   
  1538   1519     /* return 0 on success, 1 on failure. */
  1539   1520     exitcode = ((lem.errorcnt > 0) || (lem.nconflict > 0)) ? 1 : 0;
  1540         -  successful_exit = (exitcode == 0);
  1541   1521     exit(exitcode);
  1542   1522     return (exitcode);
  1543   1523   }
  1544   1524   /******************** From the file "msort.c" *******************************/
  1545   1525   /*
  1546   1526   ** A generic merge-sort program.
  1547   1527   **
................................................................................
  2757   2737     lemp->outname = file_makename(lemp, suffix);
  2758   2738     fp = fopen(lemp->outname,mode);
  2759   2739     if( fp==0 && *mode=='w' ){
  2760   2740       fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname);
  2761   2741       lemp->errorcnt++;
  2762   2742       return 0;
  2763   2743     }
  2764         -
  2765         -  /* Add files we create to a list, so we can delete them if we fail. This
  2766         -  ** is to keep makefiles from getting confused. We don't include .out files,
  2767         -  ** though: this is debug information, and you don't want it deleted if there
  2768         -  ** was an error you need to track down.
  2769         -  */
  2770         -  if(( *mode=='w' ) && (strcmp(suffix, ".out") != 0)){
  2771         -    const char **ptr = (const char **)
  2772         -        realloc(made_files, sizeof (const char **) * (made_files_count + 1));
  2773         -    const char *fname = Strsafe(lemp->outname);
  2774         -    if ((ptr == NULL) || (fname == NULL)) {
  2775         -        free(ptr);
  2776         -        memory_error();
  2777         -    }
  2778         -    made_files = ptr;
  2779         -    made_files[made_files_count++] = fname;
  2780         -  }
  2781   2744     return fp;
  2782   2745   }
  2783   2746   
  2784   2747   /* Duplicate the input file without comments and without actions 
  2785   2748   ** on rules */
  2786   2749   void Reprint(struct lemon *lemp)
  2787   2750   {