tccpp: fix token pasting ##
This patch takes advantage of new function tcc_open_bf from previous commit.
This commit is contained in:
		
							parent
							
								
									e97bf88bad
								
							
						
					
					
						commit
						44e84bb22a
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		
							
								
								
									
										8
									
								
								tccpp.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								tccpp.c
									
										
									
									
									
								
							| 
						 | 
					@ -2776,7 +2776,6 @@ static inline int *macro_twosharps(const int *macro_str)
 | 
				
			||||||
    CValue cval;
 | 
					    CValue cval;
 | 
				
			||||||
    TokenString macro_str1;
 | 
					    TokenString macro_str1;
 | 
				
			||||||
    CString cstr;
 | 
					    CString cstr;
 | 
				
			||||||
    char *p;
 | 
					 | 
				
			||||||
    int n;
 | 
					    int n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* we search the first '##' */
 | 
					    /* we search the first '##' */
 | 
				
			||||||
| 
						 | 
					@ -2809,18 +2808,17 @@ static inline int *macro_twosharps(const int *macro_str)
 | 
				
			||||||
                cstr_cat(&cstr, get_tok_str(t, &cval));
 | 
					                cstr_cat(&cstr, get_tok_str(t, &cval));
 | 
				
			||||||
                cstr_ccat(&cstr, '\0');
 | 
					                cstr_ccat(&cstr, '\0');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                p = file->buf_ptr;
 | 
					                tcc_open_bf(tcc_state, "<paste>", cstr.size);
 | 
				
			||||||
                file->buf_ptr = cstr.data;
 | 
					                memcpy(file->buffer, cstr.data, cstr.size);
 | 
				
			||||||
                for (;;) {
 | 
					                for (;;) {
 | 
				
			||||||
                    next_nomacro1();
 | 
					                    next_nomacro1();
 | 
				
			||||||
                    if (0 == *file->buf_ptr)
 | 
					                    if (0 == *file->buf_ptr)
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    tok_str_add2(¯o_str1, tok, &tokc);
 | 
					                    tok_str_add2(¯o_str1, tok, &tokc);
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    warning("pasting \"%.*s\" and \"%s\" does not give a valid preprocessing token",
 | 
					                    warning("pasting \"%.*s\" and \"%s\" does not give a valid preprocessing token",
 | 
				
			||||||
                        n, cstr.data, (char*)cstr.data + n);
 | 
					                        n, cstr.data, (char*)cstr.data + n);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                file->buf_ptr = p;
 | 
					                tcc_close();
 | 
				
			||||||
                cstr_reset(&cstr);
 | 
					                cstr_reset(&cstr);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue