/ Check-in [ca068d82]
Login

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

Overview
Comment:Fix some harmless compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | warnings
Files: files | file ages | folders
SHA3-256: ca068d82387fc3cda9d2050cedb4f9c61b6d9dc54f89015b4b2ee492243ed5c9
User & Date: mistachkin 2019-05-10 16:16:19
Context
2019-05-10
17:54
Fix harmless compiler warnings. check-in: 956ca2a4 user: drh tags: trunk
16:16
Fix some harmless compiler warnings. Closed-Leaf check-in: ca068d82 user: mistachkin tags: warnings
14:34
Ensure that the BtShared.nPage value is reset correctly on a SAVEPOINT ROLLBACK. check-in: e6d5fee8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/whereInt.h.

    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains structure and macro definitions for the query
    14     14   ** planner logic in "where.c".  These definitions are broken out into
    15     15   ** a separate source file for easier editing.
    16     16   */
           17  +#ifndef SQLITE_WHEREINT_H
           18  +#define SQLITE_WHEREINT_H
    17     19   
    18     20   /*
    19     21   ** Trace output macros
    20     22   */
    21     23   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
    22     24   /***/ extern int sqlite3WhereTrace;
    23     25   #endif
................................................................................
   580    582   #define WHERE_ONEROW       0x00001000  /* Selects no more than one row */
   581    583   #define WHERE_MULTI_OR     0x00002000  /* OR using multiple indices */
   582    584   #define WHERE_AUTO_INDEX   0x00004000  /* Uses an ephemeral index */
   583    585   #define WHERE_SKIPSCAN     0x00008000  /* Uses the skip-scan algorithm */
   584    586   #define WHERE_UNQ_WANTED   0x00010000  /* WHERE_ONEROW would have been helpful*/
   585    587   #define WHERE_PARTIALIDX   0x00020000  /* The automatic index is partial */
   586    588   #define WHERE_IN_EARLYOUT  0x00040000  /* Perhaps quit IN loops early */
          589  +
          590  +#endif /* !defined(SQLITE_WHEREINT_H) */

Changes to tool/lemon.c.

   479    479   /****************** From the file "action.c" *******************************/
   480    480   /*
   481    481   ** Routines processing parser actions in the LEMON parser generator.
   482    482   */
   483    483   
   484    484   /* Allocate a new parser action */
   485    485   static struct action *Action_new(void){
   486         -  static struct action *freelist = 0;
          486  +  static struct action *actionfreelist = 0;
   487    487     struct action *newaction;
   488    488   
   489         -  if( freelist==0 ){
          489  +  if( actionfreelist==0 ){
   490    490       int i;
   491    491       int amt = 100;
   492         -    freelist = (struct action *)calloc(amt, sizeof(struct action));
   493         -    if( freelist==0 ){
          492  +    actionfreelist = (struct action *)calloc(amt, sizeof(struct action));
          493  +    if( actionfreelist==0 ){
   494    494         fprintf(stderr,"Unable to allocate memory for a new parser action.");
   495    495         exit(1);
   496    496       }
   497         -    for(i=0; i<amt-1; i++) freelist[i].next = &freelist[i+1];
   498         -    freelist[amt-1].next = 0;
          497  +    for(i=0; i<amt-1; i++) actionfreelist[i].next = &actionfreelist[i+1];
          498  +    actionfreelist[amt-1].next = 0;
   499    499     }
   500         -  newaction = freelist;
   501         -  freelist = freelist->next;
          500  +  newaction = actionfreelist;
          501  +  actionfreelist = actionfreelist->next;
   502    502     return newaction;
   503    503   }
   504    504   
   505    505   /* Compare two actions for sorting purposes.  Return negative, zero, or
   506    506   ** positive if the first action is less than, equal to, or greater than
   507    507   ** the first
   508    508   */
................................................................................
  1903   1903       set[i] = ep;
  1904   1904     }
  1905   1905     ep = 0;
  1906   1906     for(i=0; i<LISTSIZE; i++) if( set[i] ) ep = merge(set[i],ep,cmp,offset);
  1907   1907     return ep;
  1908   1908   }
  1909   1909   /************************ From the file "option.c" **************************/
  1910         -static char **argv;
         1910  +static char **g_argv;
  1911   1911   static struct s_options *op;
  1912   1912   static FILE *errstream;
  1913   1913   
  1914   1914   #define ISOPT(X) ((X)[0]=='-'||(X)[0]=='+'||strchr((X),'=')!=0)
  1915   1915   
  1916   1916   /*
  1917   1917   ** Print the command line with a carrot pointing to the k-th character
  1918   1918   ** of the n-th field.
  1919   1919   */
  1920   1920   static void errline(int n, int k, FILE *err)
  1921   1921   {
  1922   1922     int spcnt, i;
  1923         -  if( argv[0] ) fprintf(err,"%s",argv[0]);
  1924         -  spcnt = lemonStrlen(argv[0]) + 1;
  1925         -  for(i=1; i<n && argv[i]; i++){
  1926         -    fprintf(err," %s",argv[i]);
  1927         -    spcnt += lemonStrlen(argv[i])+1;
         1923  +  if( g_argv[0] ) fprintf(err,"%s",g_argv[0]);
         1924  +  spcnt = lemonStrlen(g_argv[0]) + 1;
         1925  +  for(i=1; i<n && g_argv[i]; i++){
         1926  +    fprintf(err," %s",g_argv[i]);
         1927  +    spcnt += lemonStrlen(g_argv[i])+1;
  1928   1928     }
  1929   1929     spcnt += k;
  1930         -  for(; argv[i]; i++) fprintf(err," %s",argv[i]);
         1930  +  for(; g_argv[i]; i++) fprintf(err," %s",g_argv[i]);
  1931   1931     if( spcnt<20 ){
  1932   1932       fprintf(err,"\n%*s^-- here\n",spcnt,"");
  1933   1933     }else{
  1934   1934       fprintf(err,"\n%*shere --^\n",spcnt-7,"");
  1935   1935     }
  1936   1936   }
  1937   1937   
................................................................................
  1939   1939   ** Return the index of the N-th non-switch argument.  Return -1
  1940   1940   ** if N is out of range.
  1941   1941   */
  1942   1942   static int argindex(int n)
  1943   1943   {
  1944   1944     int i;
  1945   1945     int dashdash = 0;
  1946         -  if( argv!=0 && *argv!=0 ){
  1947         -    for(i=1; argv[i]; i++){
  1948         -      if( dashdash || !ISOPT(argv[i]) ){
         1946  +  if( g_argv!=0 && *g_argv!=0 ){
         1947  +    for(i=1; g_argv[i]; i++){
         1948  +      if( dashdash || !ISOPT(g_argv[i]) ){
  1949   1949           if( n==0 ) return i;
  1950   1950           n--;
  1951   1951         }
  1952         -      if( strcmp(argv[i],"--")==0 ) dashdash = 1;
         1952  +      if( strcmp(g_argv[i],"--")==0 ) dashdash = 1;
  1953   1953       }
  1954   1954     }
  1955   1955     return -1;
  1956   1956   }
  1957   1957   
  1958   1958   static char emsg[] = "Command line syntax error: ";
  1959   1959   
................................................................................
  1962   1962   */
  1963   1963   static int handleflags(int i, FILE *err)
  1964   1964   {
  1965   1965     int v;
  1966   1966     int errcnt = 0;
  1967   1967     int j;
  1968   1968     for(j=0; op[j].label; j++){
  1969         -    if( strncmp(&argv[i][1],op[j].label,lemonStrlen(op[j].label))==0 ) break;
         1969  +    if( strncmp(&g_argv[i][1],op[j].label,lemonStrlen(op[j].label))==0 ) break;
  1970   1970     }
  1971         -  v = argv[i][0]=='-' ? 1 : 0;
         1971  +  v = g_argv[i][0]=='-' ? 1 : 0;
  1972   1972     if( op[j].label==0 ){
  1973   1973       if( err ){
  1974   1974         fprintf(err,"%sundefined option.\n",emsg);
  1975   1975         errline(i,1,err);
  1976   1976       }
  1977   1977       errcnt++;
  1978   1978     }else if( op[j].arg==0 ){
  1979   1979       /* Ignore this option */
  1980   1980     }else if( op[j].type==OPT_FLAG ){
  1981   1981       *((int*)op[j].arg) = v;
  1982   1982     }else if( op[j].type==OPT_FFLAG ){
  1983   1983       (*(void(*)(int))(op[j].arg))(v);
  1984   1984     }else if( op[j].type==OPT_FSTR ){
  1985         -    (*(void(*)(char *))(op[j].arg))(&argv[i][2]);
         1985  +    (*(void(*)(char *))(op[j].arg))(&g_argv[i][2]);
  1986   1986     }else{
  1987   1987       if( err ){
  1988   1988         fprintf(err,"%smissing argument on switch.\n",emsg);
  1989   1989         errline(i,1,err);
  1990   1990       }
  1991   1991       errcnt++;
  1992   1992     }
................................................................................
  2000   2000   {
  2001   2001     int lv = 0;
  2002   2002     double dv = 0.0;
  2003   2003     char *sv = 0, *end;
  2004   2004     char *cp;
  2005   2005     int j;
  2006   2006     int errcnt = 0;
  2007         -  cp = strchr(argv[i],'=');
         2007  +  cp = strchr(g_argv[i],'=');
  2008   2008     assert( cp!=0 );
  2009   2009     *cp = 0;
  2010   2010     for(j=0; op[j].label; j++){
  2011         -    if( strcmp(argv[i],op[j].label)==0 ) break;
         2011  +    if( strcmp(g_argv[i],op[j].label)==0 ) break;
  2012   2012     }
  2013   2013     *cp = '=';
  2014   2014     if( op[j].label==0 ){
  2015   2015       if( err ){
  2016   2016         fprintf(err,"%sundefined option.\n",emsg);
  2017   2017         errline(i,0,err);
  2018   2018       }
................................................................................
  2031   2031         case OPT_DBL:
  2032   2032         case OPT_FDBL:
  2033   2033           dv = strtod(cp,&end);
  2034   2034           if( *end ){
  2035   2035             if( err ){
  2036   2036               fprintf(err,
  2037   2037                  "%sillegal character in floating-point argument.\n",emsg);
  2038         -            errline(i,(int)((char*)end-(char*)argv[i]),err);
         2038  +            errline(i,(int)((char*)end-(char*)g_argv[i]),err);
  2039   2039             }
  2040   2040             errcnt++;
  2041   2041           }
  2042   2042           break;
  2043   2043         case OPT_INT:
  2044   2044         case OPT_FINT:
  2045   2045           lv = strtol(cp,&end,0);
  2046   2046           if( *end ){
  2047   2047             if( err ){
  2048   2048               fprintf(err,"%sillegal character in integer argument.\n",emsg);
  2049         -            errline(i,(int)((char*)end-(char*)argv[i]),err);
         2049  +            errline(i,(int)((char*)end-(char*)g_argv[i]),err);
  2050   2050             }
  2051   2051             errcnt++;
  2052   2052           }
  2053   2053           break;
  2054   2054         case OPT_STR:
  2055   2055         case OPT_FSTR:
  2056   2056           sv = cp;
................................................................................
  2082   2082     }
  2083   2083     return errcnt;
  2084   2084   }
  2085   2085   
  2086   2086   int OptInit(char **a, struct s_options *o, FILE *err)
  2087   2087   {
  2088   2088     int errcnt = 0;
  2089         -  argv = a;
         2089  +  g_argv = a;
  2090   2090     op = o;
  2091   2091     errstream = err;
  2092         -  if( argv && *argv && op ){
         2092  +  if( g_argv && *g_argv && op ){
  2093   2093       int i;
  2094         -    for(i=1; argv[i]; i++){
  2095         -      if( argv[i][0]=='+' || argv[i][0]=='-' ){
         2094  +    for(i=1; g_argv[i]; i++){
         2095  +      if( g_argv[i][0]=='+' || g_argv[i][0]=='-' ){
  2096   2096           errcnt += handleflags(i,err);
  2097         -      }else if( strchr(argv[i],'=') ){
         2097  +      }else if( strchr(g_argv[i],'=') ){
  2098   2098           errcnt += handleswitch(i,err);
  2099   2099         }
  2100   2100       }
  2101   2101     }
  2102   2102     if( errcnt>0 ){
  2103   2103       fprintf(err,"Valid command line options for \"%s\" are:\n",*a);
  2104   2104       OptPrint();
................................................................................
  2107   2107     return 0;
  2108   2108   }
  2109   2109   
  2110   2110   int OptNArgs(void){
  2111   2111     int cnt = 0;
  2112   2112     int dashdash = 0;
  2113   2113     int i;
  2114         -  if( argv!=0 && argv[0]!=0 ){
  2115         -    for(i=1; argv[i]; i++){
  2116         -      if( dashdash || !ISOPT(argv[i]) ) cnt++;
  2117         -      if( strcmp(argv[i],"--")==0 ) dashdash = 1;
         2114  +  if( g_argv!=0 && g_argv[0]!=0 ){
         2115  +    for(i=1; g_argv[i]; i++){
         2116  +      if( dashdash || !ISOPT(g_argv[i]) ) cnt++;
         2117  +      if( strcmp(g_argv[i],"--")==0 ) dashdash = 1;
  2118   2118       }
  2119   2119     }
  2120   2120     return cnt;
  2121   2121   }
  2122   2122   
  2123   2123   char *OptArg(int n)
  2124   2124   {
  2125   2125     int i;
  2126   2126     i = argindex(n);
  2127         -  return i>=0 ? argv[i] : 0;
         2127  +  return i>=0 ? g_argv[i] : 0;
  2128   2128   }
  2129   2129   
  2130   2130   void OptErr(int n)
  2131   2131   {
  2132   2132     int i;
  2133   2133     i = argindex(n);
  2134   2134     if( i>=0 ) errline(i,0,errstream);
................................................................................
  2724   2724             psp->errorcnt++;
  2725   2725           }
  2726   2726         }
  2727   2727         break;
  2728   2728       case WAITING_FOR_CLASS_ID:
  2729   2729         if( !ISLOWER(x[0]) ){
  2730   2730           ErrorMsg(psp->filename, psp->tokenlineno,
  2731         -          "%%token_class must be followed by an identifier: ", x);
         2731  +          "%%token_class must be followed by an identifier: %s", x);
  2732   2732           psp->errorcnt++;
  2733   2733           psp->state = RESYNC_AFTER_DECL_ERROR;
  2734   2734        }else if( Symbol_find(x) ){
  2735   2735           ErrorMsg(psp->filename, psp->tokenlineno,
  2736   2736             "Symbol \"%s\" already used", x);
  2737   2737           psp->errorcnt++;
  2738   2738           psp->state = RESYNC_AFTER_DECL_ERROR;