diff --git a/M2libc b/M2libc index c684e92..08a6615 160000 --- a/M2libc +++ b/M2libc @@ -1 +1 @@ -Subproject commit c684e9275ff4b8ef45a970990e0a2959cef9a8c5 +Subproject commit 08a66159da8076c72f1bbf8115f8af6ec64d3af3 diff --git a/cc_macro.c b/cc_macro.c index 4ff6f53..6e44139 100644 --- a/cc_macro.c +++ b/cc_macro.c @@ -739,33 +739,6 @@ void macro_directive() { handle_error(); } - else if(match("#include", macro_token->s)) - { - eat_current_token(); - if(match("<", macro_token->s)) - { - eat_current_token(); - if(match("stdio", macro_token->s)) - { - eat_current_token(); - STDIO_USED = TRUE; - } - } - while(TRUE) - { - if(NULL == macro_token) - { - return; - } - - if('\n' == macro_token->s[0]) - { - return; - } - - eat_current_token(); - } - } else if(match("#FILENAME", macro_token->s)) { while(TRUE) diff --git a/cc_reader.c b/cc_reader.c index d47f8e5..2f4ca84 100644 --- a/cc_reader.c +++ b/cc_reader.c @@ -314,8 +314,8 @@ void insert_file_header(char* name, int line) strcat(hold_string, name); strcat(hold_string, " "); strcat(hold_string, hold_line); - strcat(hold_string, "\n"); new_token(hold_string, strlen(hold_string)+2); + new_token("\n", 3); } struct token_list* read_all_tokens(FILE* a, struct token_list* current, char* filename); @@ -346,6 +346,7 @@ int include_file(int ch) { char* path = env_lookup("M2LIBC_PATH"); if(NULL == path) path = "./M2libc"; + if(match("stdio.h", new_filename + 1)) STDIO_USED = TRUE; reset_hold_string(); strcat(hold_string, path); strcat(hold_string, "/");