remove support for compiler-builtin c-code (it was broken anyway and never produced...
authorMatthias Braun <matze@braunis.de>
Mon, 18 Jul 2011 12:55:18 +0000 (14:55 +0200)
committerMatthias Braun <matze@braunis.de>
Tue, 9 Aug 2011 18:10:52 +0000 (20:10 +0200)
.build_plugin
Makefile
builtins/builtins.c [deleted file]
lexer.c
lexer.h
main.c

index ad2efb5..3fb9b3b 100644 (file)
@@ -4,29 +4,6 @@ for d in $(DIRS) {
        SOURCES += [ Wildcard $(PLUGIN_DIR)/$(d) : *.c *.h ] ;
 }
 
-actions RunBuiltinGenerator bind GENERATOR {
-       $(GENERATOR) $(>) > $(<)
-}
-
-rule BuiltinGenerator {
-       local target = $(<) ;
-       local source = [ SearchSource $(>) ] ;
-       local generator = [ SearchSource $(3) ] ;
-       local header = $(target) ;
-       Depends $(target) : $(generator) ;
-       Depends $(target) : $(source) ;
-       RunBuiltinGenerator $(target) : $(source) ;
-       GENERATOR on $(target) = $(generator) ;
-
-       NP = $(header:D=) ;
-       Includes $(NP:G=) : $(header) ;
-
-       Clean clean : $(target) ;
-
-       return $(target) ;
-}
-BuiltinGenerator $(PLUGIN_DIR)/gen_builtins.h : $(PLUGIN_DIR)/builtins/builtins.c : $(PLUGIN_DIR)/create_builtins_h.sh ;
-
 Application cparser : $(SOURCES) ;
 IncludeDir cparser : libfirm/include libfirm/include/libfirm ;
 IncludeDir cparser : $(PLUGIN_DIR) ;
index 272bbee..25690dc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -116,12 +116,6 @@ bootstrap2: build/cpb2 build/cpb2/adt build/cpb2/driver $(CPARSEROS2) cparser.bo
        @echo '===> CPARSER $<'
        $(Q)./cparser $(CPPFLAGS) -fsyntax-only $<
 
-gen_builtins.h: builtins/builtins.c create_builtins_h.sh
-       @echo '===> CREATE_BUILTINS $<'
-       $(Q)./create_builtins_h.sh "$<" > $@
-
-main.c: gen_builtins.h
-
 build/cpb/%.o: %.c build/cparser
        @echo '===> CPARSER $<'
        $(Q)./build/cparser $(CPPFLAGS) -std=c99 -Wall -g3 -c $< -o $@
@@ -154,4 +148,4 @@ build/%.o: %.c
 
 clean:
        @echo '===> CLEAN'
-       $(Q)rm -rf gen_builtins.h build/* $(GOAL) .depend
+       $(Q)rm -rf build/* $(GOAL) .depend
diff --git a/builtins/builtins.c b/builtins/builtins.c
deleted file mode 100644 (file)
index 026f8e2..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-static inline char *strchr(const char *s, int c)
-{
-       do {
-               if (*s == c)
-                       return (char*) s;
-       } while (*s++ != '\0');
-       return (char*) 0;
-}
-
-static inline char *strrchr(const char *s, int c)
-{
-       const char *result = (const char*) 0;
-
-       do {
-               if (*s == c)
-                       result = s;
-       } while (*s++ != '\0');
-       return (char*) result;
-}
-
-static inline int strcmp(const char *s1, const char *s2)
-{
-       for( ; *s1 != 0; ++s1, ++s2) {
-               if(*s1 != *s2)
-                       break;
-       }
-       return (unsigned char)*s1 - (unsigned char)*s2;
-}
-
-/*
-static inline __SIZE_TYPE__ strlen(const char *s)
-{
-       __SIZE_TYPE__ result = 0;
-       for ( ; *s != 0; ++s)
-               result++;
-       return result;
-}
-*/
-
-static inline __SIZE_TYPE__ strlen(const char *str)
-{
-       const char          *char_ptr;
-       const unsigned long *long_ptr;
-       unsigned long int longword, magic_bits, himagic, lomagic;
-       int abort(void);
-
-       for (char_ptr = str; ((unsigned long int) char_ptr & (sizeof(longword)-1)) != 0; ++char_ptr) {
-               if (*char_ptr == '\0')
-                       return char_ptr - str;
-       }
-
-       long_ptr = (unsigned long int*) char_ptr;
-       magic_bits = 0x7efefeffL;
-       himagic    = 0x80808080L;
-       lomagic    = 0x01010101L;
-       if (sizeof(longword) > 4)
-               abort();
-
-       for(;;) {
-               longword = *long_ptr++;
-               if (((longword - lomagic) & himagic) != 0) {
-                       const char *cp = (const char*) (long_ptr - 1);
-                       if (cp[0] == 0)
-                               return cp-str;
-                       if (cp[1] == 0)
-                               return cp-str+1;
-                       if (cp[2] == 0)
-                               return cp-str+2;
-                       if (cp[3] == 0)
-                               return cp-str+3;
-               }
-       }
-}
-
-static inline char *strcpy(char *dest, const char *source)
-{
-       char *d = dest;
-       while ((*d++ = *source++) != '\0') {}
-       return dest;
-}
diff --git a/lexer.c b/lexer.c
index fad043d..a400d7f 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -1628,27 +1628,6 @@ void lexer_open_stream(FILE *stream, const char *input_name)
        c = '\n';
 }
 
-void lexer_open_buffer(const char *buffer, size_t len, const char *input_name)
-{
-       input                = NULL;
-       lexer_pos.lineno     = 0;
-       lexer_pos.colno      = 0;
-       lexer_pos.input_name = input_name;
-
-#if 0 // TODO
-       bufpos = buffer;
-       bufend = buffer + len;
-
-       /* place a virtual \n at the beginning so the lexer knows that we're
-        * at the beginning of a line */
-       c = '\n';
-#else
-       (void)buffer;
-       (void)len;
-       panic("builtin lexing not done yet");
-#endif
-}
-
 void exit_lexer(void)
 {
        strset_destroy(&stringset);
diff --git a/lexer.h b/lexer.h
index a34d591..df7bebb 100644 (file)
--- a/lexer.h
+++ b/lexer.h
@@ -37,7 +37,6 @@ void exit_lexer(void);
 void select_input_encoding(char const* encoding);
 
 void lexer_open_stream(FILE *stream, const char *input_name);
-void lexer_open_buffer(const char *buffer, size_t len, const char *input_name);
 
 string_t concat_strings(const string_t *s1, const string_t *s2);
 string_t make_string(const char *str);
diff --git a/main.c b/main.c
index 7ef6662..f0be72c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -111,7 +111,6 @@ bool               freestanding              = false;
 static machine_triple_t *target_machine;
 static const char       *target_triple;
 static int               verbose;
-static bool              use_builtins;
 static struct obstack    cppflags_obst;
 static struct obstack    ldflags_obst;
 static struct obstack    asflags_obst;
@@ -179,17 +178,10 @@ static void get_output_name(char *buf, size_t buflen, const char *inputname,
                panic("filename too long");
 }
 
-#include "gen_builtins.h"
-
 static translation_unit_t *do_parsing(FILE *const in, const char *const input_name)
 {
        start_parsing();
 
-       if (use_builtins) {
-               lexer_open_buffer(builtins, sizeof(builtins)-1, "<builtin>");
-               parse();
-       }
-
        lexer_open_stream(in, input_name);
        parse();
 
@@ -1078,9 +1070,7 @@ int main(int argc, char **argv)
                                                opt += 3;
                                        }
 
-                                       if (streq(opt, "builtins")) {
-                                               use_builtins = truth_value;
-                                       } else if (streq(opt, "diagnostics-show-option")) {
+                                       if (streq(opt, "diagnostics-show-option")) {
                                                diagnostics_show_option = truth_value;
                                        } else if (streq(opt, "dollars-in-identifiers")) {
                                                allow_dollar_in_symbol = truth_value;