fix redundant #defines

Removed from errsym.h (as built by errcode -d via the Makefile),
E__NONE, E__BASE, E__USERDEF, and E__USERMAX.  These symbols were
also defined in errtbl.h, which is NOW the place of the #define.

Update .gitigore with another temporary file.
This commit is contained in:
Landon Curt Noll
2023-09-13 20:55:22 -07:00
parent 40c8f875c1
commit 3b9393a8ac
5 changed files with 16 additions and 19 deletions

11
.gitignore vendored
View File

@@ -23,8 +23,6 @@ core*
.dynamic
.hsrc
.static
Makefile.our
NOTES
align32
align32.h
args.h
@@ -42,12 +40,12 @@ conf.h
const_tmp
cscript/.all
cscript/4dsphere
cscript/README
cscript/fproduct
cscript/mersenne
cscript/piforever
cscript/plus
cscript/powerterm
cscript/README
cscript/simple
cscript/square
custom/.all
@@ -120,8 +118,6 @@ have_ustat
have_ustat.h
have_varvs
help/.all
help/COPYING
help/COPYING-LGPL
help/binding
help/bindings
help/bug
@@ -131,6 +127,8 @@ help/change
help/changes
help/contrib
help/copy
help/COPYING
help/COPYING-LGPL
help/cscript
help/custom_cal
help/errorcode
@@ -152,12 +150,15 @@ libcalc.*
libcustcalc.*
longbits
longbits.h
Makefile.our
NOTES
outfile
sample_many
sample_many-static
sample_rand
sample_rand-static
status.chk_c.h
strdup_tmp
tags
terminal.h
unused_tmp

View File

@@ -5519,6 +5519,7 @@ value.o: config.h
value.o: decl.h
value.o: endian_calc.h
value.o: errsym.h
value.o: errtbl.h
value.o: file.h
value.o: func.h
value.o: hash.h

View File

@@ -827,13 +827,13 @@ print_errorcodes(void)
}
/*
* print the help/errorcodes.h file trailer
* print the help/errorcodes file trailer
*/
printf("\n"
"\"E__HIGHEST\"\t%ld\thighest assigned calc computation error code\n"
"\"E__USERDEF\"\t%d\tuser defined error codes start here\n"
"\"E__USERMAX\"\t%d\tmaximum user defined error code\n",
MY_E__HIGHEST, E__USERDEF, E__USERMAX);
"\"E__HIGHEST\"\t%ld\thighest assigned calc computation error code\n"
"\"E__USERDEF\"\t%d\tuser defined error codes start here\n"
"\"E__USERMAX\"\t%d\tmaximum user defined error code\n",
MY_E__HIGHEST, E__USERDEF, E__USERMAX);
printf("\n"
"## Copyright (C) %d Landon Curt Noll\n"
"##\n"
@@ -905,10 +905,6 @@ print_errsym(void)
"\n"
"\n",
ERRTBL_COPYRIGHT_YEAR);
printf("#define E__NONE\t\t%d\t/* calc_errno cleared: libc errno codes above here */\n"
"#define E__BASE\t\t%d\t/* Reserved for \"No error\" calc internal state */\n"
"\n",
E__NONE, E__BASE);
/*
* print the #define lines
@@ -929,11 +925,9 @@ print_errsym(void)
*/
printf("\n"
"#define E__HIGHEST\t%ld\t/* highest assigned calc computation error code */\n"
"#define E__USERDEF\t%d\t/* user defined error codes start here */\n"
"#define E__USERMAX\t%d\t/* maximum user defined error code */\n"
"\n"
"#define ECOUNT\t%ld\t/* number of calc computation error codes w/o E__BASE */\n",
MY_E__HIGHEST, E__USERDEF, E__USERMAX, MY_ECOUNT);
MY_E__HIGHEST, MY_ECOUNT);
printf("\n"
"\n"
"#endif /* !INCLUDE_ERRSYM_H */\n");

4
func.c
View File

@@ -8087,7 +8087,7 @@ f_newerror(int count, VALUE **vals)
if (index >= 0) {
errnum = E__USERDEF + index;
} else {
if (nexterrnum == 32767)
if (nexterrnum == E__USERMAX)
math_error("Too many new error values");
errnum = nexterrnum++;
addstr(&newerrorstr, str);
@@ -8116,7 +8116,7 @@ f_strerror(int count, VALUE **vals)
if (vp->v_type != V_NUM || qisfrac(vp->v_num))
return error_value(E_STRERROR1);
i = qtoi(vp->v_num);
if (i < 0 || i > 32767)
if (i < 0 || i > E__USERMAX)
return error_value(E_STRERROR2);
}
} else {

View File

@@ -37,6 +37,7 @@
#include "nametype.h"
#include "file.h"
#include "config.h"
#include "errtbl.h"
#include "attribute.h"