summaryrefslogtreecommitdiff
path: root/gcc/fixinc
diff options
context:
space:
mode:
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-12 14:45:05 +0000
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-12 14:45:05 +0000
commit7cd86c4d94d43ca9f4d6e1ea551c91d3fa3b08c9 (patch)
tree7d2fd8091e15b04900838327a8bf2a8122c99c9e /gcc/fixinc
parentb0a314a73abe1bac45a3d39d1e91bed457b2410d (diff)
downloadgcc-7cd86c4d94d43ca9f4d6e1ea551c91d3fa3b08c9.tar.gz
removed dinkleberries and use xmalloc instead of a private version
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34986 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc')
-rw-r--r--gcc/fixinc/fixfixes.c2
-rw-r--r--gcc/fixinc/fixincl.c2
-rw-r--r--gcc/fixinc/fixlib.c54
-rw-r--r--gcc/fixinc/fixlib.h7
-rw-r--r--gcc/fixinc/fixtests.c3
5 files changed, 48 insertions, 20 deletions
diff --git a/gcc/fixinc/fixfixes.c b/gcc/fixinc/fixfixes.c
index 4719a51ab61..dd08e808dcf 100644
--- a/gcc/fixinc/fixfixes.c
+++ b/gcc/fixinc/fixfixes.c
@@ -567,7 +567,7 @@ FIX_PROC_HEAD( wrap_fix )
*(pz_dst++) = '_';
if (++len >= sizeof( z_fixname )) {
- void* p = must_malloc( len + strlen( pz_src ) + 1 );
+ void* p = xmalloc( len + strlen( pz_src ) + 1 );
memcpy( p, (void*)z_fixname, len );
pz_name = (tCC*)p;
pz_dst = (char*)pz_name + len;
diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c
index 1dfc6adaf4f..113827fef2f 100644
--- a/gcc/fixinc/fixincl.c
+++ b/gcc/fixinc/fixincl.c
@@ -206,6 +206,8 @@ initialize ( argc, argv )
"fixincl ERROR: %s environment variable not defined\n\
\tTARGET_MACHINE, DESTDIR, SRCDIR and FIND_BASE are required\n";
+ xmalloc_set_program_name (argv[0]);
+
switch (argc)
{
case 1:
diff --git a/gcc/fixinc/fixlib.c b/gcc/fixinc/fixlib.c
index bafe2612c07..c2c77ebe0e5 100644
--- a/gcc/fixinc/fixlib.c
+++ b/gcc/fixinc/fixlib.c
@@ -24,20 +24,6 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h"
-void *
-must_malloc( siz )
- size_t siz;
-{
- void* res = malloc( siz );
-
- if (res == (void*)NULL) {
- fprintf( stderr, "fixincl failed to malloc %d bytes\n", siz );
- exit( 3 );
- }
-
- return res;
-}
-
/* * * * * * * * * * * * *
load_file_data loads all the contents of a file into malloc-ed memory.
@@ -95,7 +81,7 @@ load_file_data (fp)
return pz_data;
}
-
+#ifdef IS_CXX_HEADER_NEEDED
t_bool
is_cxx_header (fname, text)
tCC *fname;
@@ -153,6 +139,44 @@ template[ \t]*<|\
return BOOL_FALSE;
}
+#endif /* CXX_TYPE_NEEDED */
+
+#ifdef SKIP_QUOTE_NEEDED
+/*
+ * Skip over a quoted string. Single quote strings may
+ * contain multiple characters if the first character is
+ * a backslash. Especially a backslash followed by octal digits.
+ * We are not doing a correctness syntax check here.
+ */
+tCC*
+skip_quote( q, text )
+ char q;
+ char* text;
+{
+ for (;;)
+ {
+ char ch = *(text++);
+ switch (ch)
+ {
+ case '\\':
+ text++; /* skip over whatever character follows */
+ break;
+
+ case '"':
+ case '\'':
+ if (ch != q)
+ break;
+ /*FALLTHROUGH*/
+
+ case '\n':
+ case NUL:
+ goto skip_done;
+ }
+ } skip_done:;
+
+ return text;
+}
+#endif /* SKIP_QUOTE_NEEDED */
/* * * * * * * * * * * * *
diff --git a/gcc/fixinc/fixlib.h b/gcc/fixinc/fixlib.h
index 5cbf41239da..99975532d73 100644
--- a/gcc/fixinc/fixlib.h
+++ b/gcc/fixinc/fixlib.h
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */
#include "gnu-regex.h"
#include "machname.h"
+#include "libiberty.h"
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
@@ -152,10 +153,14 @@ struct fix_desc
* Exported procedures
*/
char * load_file_data _P_(( FILE* fp ));
+#ifdef IS_CXX_HEADER_NEEDED
t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext ));
+#endif /* IS_CXX_HEADER_NEEDED */
+#ifdef SKIP_QUOTE_NEEDED
+tCC* skip_quote _P_(( char q, char* text ));
+#endif
void compile_re _P_(( tCC* pat, regex_t* re, int match,
tCC *e1, tCC *e2 ));
-void* must_malloc _P_(( size_t ));
void apply_fix _P_(( tFixDesc* p_fixd, tCC* filname ));
apply_fix_p_t run_test _P_((tCC* t_name, tCC* f_name, tCC* text ));
diff --git a/gcc/fixinc/fixtests.c b/gcc/fixinc/fixtests.c
index 36dd6553b14..0da04b51774 100644
--- a/gcc/fixinc/fixtests.c
+++ b/gcc/fixinc/fixtests.c
@@ -47,9 +47,6 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h"
-#define SHOULD_APPLY(afp) ((afp) == APPLY_FIX)
-apply_fix_p_t run_test();
-
typedef struct {
tCC* test_name;
apply_fix_p_t (*test_proc)();