Update of /cvsroot/monetdb/buildtools/burg
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18663/burg
Modified Files:
Tag: MonetDB_1-20
b.h be.c burs.c closure.c delta.c fe.c gram.y item.c lex.c
list.c main.c nonterminal.c operator.c pattern.c plank.c
queue.c rule.c string.c symtab.c table.c trim.c winconfig.h
zalloc.c
Log Message:
Reduced the number of warnings when compiling on Windows.
Index: trim.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/trim.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- trim.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ trim.c 28 Nov 2007 11:36:08 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_trim[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
#include "fe.h"
Index: pattern.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/pattern.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- pattern.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ pattern.c 28 Nov 2007 11:36:01 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_pattern[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
Index: zalloc.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/zalloc.c,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- zalloc.c 20 Jul 2007 08:25:08 -0000 1.3
+++ zalloc.c 28 Nov 2007 11:36:09 -0000 1.3.2.1
@@ -1,5 +1,6 @@
char rcsid_zalloc[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Index: table.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/table.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- table.c 26 Jul 2005 13:47:34 -0000 1.1.1.1
+++ table.c 28 Nov 2007 11:36:07 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_table[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <string.h>
#include <stdio.h>
Index: plank.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/plank.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- plank.c 21 Jun 2007 20:39:18 -0000 1.2
+++ plank.c 28 Nov 2007 11:36:02 -0000 1.2.2.1
@@ -1,11 +1,20 @@
char rcsid_plank[] = "$Id$";
+#include "burg_config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "b.h"
#include "fe.h"
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+
+#define snprintf _snprintf
+#endif
+
#define ERROR_VAL 0
int speedflag = 0;
@@ -52,9 +61,13 @@
static int num = 0;
p = (Plank) zalloc(sizeof(struct plank));
- sprintf(buf, "%s_plank_%d", prefix, num++);
+ snprintf(buf, sizeof(buf), "%s_plank_%d", prefix, num++);
+#ifdef HAVE_STRDUP
+ p->name = strdup(buf);
+#else
p->name = (char *) zalloc(strlen(buf)+1);
strcpy(p->name, buf);
+#endif
return p;
}
@@ -77,9 +90,13 @@
StateMap sm;
sm = (StateMap) zalloc(sizeof(struct stateMap));
- sprintf(buf, "f%d", num++);
+ snprintf(buf, sizeof(buf), "f%d", num++);
+#ifdef HAVE_STRDUP
+ sm->fieldname = strdup(buf);
+#else
sm->fieldname = (char *) zalloc(strlen(buf)+1);
strcpy(sm->fieldname, buf);
+#endif
return sm;
}
@@ -675,10 +692,10 @@
} else {
assert(im0->offset == 0);
assert(im1->offset == 0);
- sprintf(buf, "l = %s[l].%s",
+ snprintf(buf, sizeof(buf), "l = %s[l].%s",
im0->values->plank->name,
im0->values->fieldname);
exceptionSwitch(im0->exceptions, "l", "l =", "break;",
0, buf);
- sprintf(buf, "r = %s[r].%s",
+ snprintf(buf, sizeof(buf), "r = %s[r].%s",
im1->values->plank->name,
im1->values->fieldname);
exceptionSwitch(im1->exceptions, "r", "r =", "break;",
0, buf);
@@ -787,10 +804,10 @@
assert(im0->offset == 0);
assert(im1->offset == 0);
/*
- sprintf(buf, "l = %s[l].%s",
+ snprintf(buf, sizeof(buf), "l = %s[l].%s",
im0->values->plank->name,
im0->values->fieldname);
exceptionSwitch(im0->exceptions, "l", "l =", "break;",
0, buf);
- sprintf(buf, "r = %s[r].%s",
+ snprintf(buf, sizeof(buf), "r = %s[r].%s",
im1->values->plank->name,
im1->values->fieldname);
exceptionSwitch(im1->exceptions, "r", "r =", "break;",
0, buf);
Index: nonterminal.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/nonterminal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- nonterminal.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ nonterminal.c 28 Nov 2007 11:35:59 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_nonterminal[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
#include <string.h>
@@ -10,7 +11,7 @@
List nonterminals;
NonTerminal
-newNonTerminal(name) char *name;
+newNonTerminal(char *name)
{
NonTerminal nt;
@@ -27,7 +28,7 @@
}
int
-nonTerminalName(buf, i) char *buf; int i;
+nonTerminalName(char *buf, size_t len, int i)
{
List l;
/* extern char *strcpy ARGS((char *, char *)); */
@@ -35,16 +36,16 @@
for (l = nonterminals; l; l = l->next) {
NonTerminal nt = (NonTerminal) l->x;
if (nt->num == i) {
- strcpy(buf, nt->name);
+ strncpy(buf, nt->name, len);
return 1;
}
}
- strcpy(buf, "(Unknown NonTerminal)");
+ strncpy(buf, "(Unknown NonTerminal)", len);
return 0;
}
void
-dumpNonTerminal(n) NonTerminal n;
+dumpNonTerminal(NonTerminal n)
{
printf("%s(%d)", n->name, n->num);
}
Index: symtab.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/symtab.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- symtab.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ symtab.c 28 Nov 2007 11:36:06 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_symtab[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include "b.h"
Index: list.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/list.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- list.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ list.c 28 Nov 2007 11:35:58 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_list[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
IntList
Index: gram.y
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/gram.y,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- gram.y 9 Feb 2007 22:58:02 -0000 1.2
+++ gram.y 28 Nov 2007 11:35:56 -0000 1.2.4.1
@@ -1,6 +1,7 @@
%{
char rcsid_gram[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
#include "fe.h"
Index: operator.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/operator.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- operator.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ operator.c 28 Nov 2007 11:36:00 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_operator[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
Index: item.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/item.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- item.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ item.c 28 Nov 2007 11:35:57 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_item[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
#include <string.h>
Index: queue.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/queue.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- queue.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ queue.c 28 Nov 2007 11:36:02 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_queue[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
Index: closure.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/closure.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- closure.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ closure.c 28 Nov 2007 11:35:54 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_closure[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
Index: winconfig.h
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/winconfig.h,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- winconfig.h 24 Jan 2007 23:34:19 -0000 1.2
+++ winconfig.h 28 Nov 2007 11:36:09 -0000 1.2.4.1
@@ -24,6 +24,7 @@
/* Visual Studio 8 has deprecated lots of stuff: suppress warnings */
#define _CRT_SECURE_NO_DEPRECATE 1
+#define _CRT_SECURE_NO_WARNINGS 1
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
Index: be.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/be.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- be.c 21 Jun 2007 20:39:18 -0000 1.4
+++ be.c 28 Nov 2007 11:35:52 -0000 1.4.2.1
@@ -1,6 +1,6 @@
char rcsid_be[] = "$Id$";
-#include <burg_config.h>
+#include "burg_config.h"
#include <stdio.h>
Index: rule.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/rule.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- rule.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ rule.c 28 Nov 2007 11:36:03 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_rule[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
Index: lex.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/lex.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- lex.c 20 Jul 2007 08:25:07 -0000 1.5
+++ lex.c 28 Nov 2007 11:35:58 -0000 1.5.2.1
@@ -1,5 +1,6 @@
char rcsid_lex[] = "$Id$";
+#include "burg_config.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
Index: main.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/main.c,v
retrieving revision 1.2.12.1
retrieving revision 1.2.12.2
diff -u -d -r1.2.12.1 -r1.2.12.2
--- main.c 28 Nov 2007 10:21:10 -0000 1.2.12.1
+++ main.c 28 Nov 2007 11:35:59 -0000 1.2.12.2
@@ -22,6 +22,12 @@
#if HAVE_STRING_H && HAVE_STRDUP
#include <string.h>
+
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+#endif
#else
static char *strdup (const char *);
#endif
Index: string.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/string.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- string.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ string.c 28 Nov 2007 11:36:04 -0000 1.1.1.1.12.1
@@ -1,10 +1,17 @@
char rcsid_string[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include "b.h"
#include "fe.h"
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+#endif
+
static StrTableElement newStrTableElement ARGS((void));
StrTable
@@ -57,8 +64,12 @@
}
ste = newStrTableElement();
ste->erulenos = newIntList(eruleno, 0);
+#ifdef HAVE_STRDUP
+ ste->str = strdup(s);
+#else
ste->str = (char *) zalloc(strlen(s) + 1);
strcpy(ste->str, s);
+#endif
t->elems = newList(ste, t->elems);
*new = 1;
return ste;
Index: fe.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/fe.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- fe.c 17 Jul 2007 11:17:32 -0000 1.2
+++ fe.c 28 Nov 2007 11:35:56 -0000 1.2.2.1
@@ -1,10 +1,19 @@
char rcsid_fe[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include "b.h"
#include "fe.h"
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+
+#define snprintf _snprintf
+#endif
+
int grammarflag;
static int arity;
@@ -69,9 +78,13 @@
return x->normalizer;
}
}
- sprintf(buf, "n%%%d", tcount++);
+ snprintf(buf, sizeof(buf), "n%%%d", tcount++);
+#ifdef HAVE_STRDUP
+ s = strdup(buf);
+#else
s = (char *) zalloc(strlen(buf)+1);
strcpy(s, buf);
+#endif
n = newNonTerminal(s);
p->normalizer = n;
xpatterns = newList(p, xpatterns);
Index: delta.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/delta.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- delta.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ delta.c 28 Nov 2007 11:35:55 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_delta[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
#include "fe.h"
@@ -115,8 +116,8 @@
if (c[i] > prevent_divergence) {
char ntname[100];
char basename[100];
- nonTerminalName(ntname, nt);
- nonTerminalName(basename, base);
+ nonTerminalName(ntname, sizeof(ntname), nt);
+ nonTerminalName(basename, sizeof(basename),
base);
fprintf(stderr, "ERROR: The grammar appears to
diverge\n");
fprintf(stderr, "\tRelative Costs: %s(0),
%s(%d)\n", basename, ntname, c[i]);
fprintf(stderr, "\tOffending Operator: %s\n",
its->op->name);
@@ -130,8 +131,8 @@
} else if (PRINCIPLECOST(c) > prevent_divergence) {
char ntname[100];
char basename[100];
- nonTerminalName(ntname, nt);
- nonTerminalName(basename, base);
+ nonTerminalName(ntname, sizeof(ntname), nt);
+ nonTerminalName(basename, sizeof(basename), base);
fprintf(stderr, "ERROR: The grammar appears to diverge\n");
fprintf(stderr, "\tRelative Costs: %s(0), %s(%d)\n", basename,
ntname, PRINCIPLECOST(c));
fprintf(stderr, "\tOffending Operator: %s\n", its->op->name);
Index: burs.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/burs.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -u -d -r1.1.1.1 -r1.1.1.1.12.1
--- burs.c 26 Jul 2005 13:47:34 -0000 1.1.1.1
+++ burs.c 28 Nov 2007 11:35:54 -0000 1.1.1.1.12.1
@@ -1,5 +1,6 @@
char rcsid_burs[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
Item_Set errorState;
Index: b.h
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/b.h,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -d -r1.7 -r1.7.2.1
--- b.h 5 Sep 2007 21:08:15 -0000 1.7
+++ b.h 28 Nov 2007 11:35:51 -0000 1.7.2.1
@@ -216,7 +216,7 @@
extern void freeItem_Set ARGS((Item_Set));
extern Mapping newMapping ARGS((int));
extern NonTerminal newNonTerminal ARGS((char *));
-extern int nonTerminalName ARGS((char *, int));
+extern int nonTerminalName ARGS((char *, size_t, int));
extern Operator newOperator ARGS((char *, OperatorNum, ArityNum));
extern Pattern newPattern ARGS((Operator));
extern Rule newRule ARGS((DeltaPtr, ERuleNum, NonTerminal, Pattern));
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins