[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] 0.9.22: GNU nano compile error
From: |
charlesrandall4-tinycc |
Subject: |
Re: [Tinycc-devel] 0.9.22: GNU nano compile error |
Date: |
Wed, 17 Nov 2004 20:24:37 -0800 (PST) |
I worked through the error in the nano code below.
However, I have isolated the bug which resulted in the
line number being off by one. Here's the sample code.
1 #define _(s) blah(s)
2 extern void f();
3 void version(void)
4 {
5 f(_
6 ("x"));
7 `
8 }
Note the backtick at line seven.
When compiled with tcc it points to line six,
# tcc lineno.c
lineno.c:6: unrecognized character \x60
And when compiled with gcc, I get line seven as
expected,
# gcc lineno.c
lineno.c: In function `version':
lineno.c:7: stray '`' in program
-Charles
--- address@hidden wrote:
> --- Laurent Charmet <address@hidden>
> > NULL is for pointer, and *read_buff_ptr is a char.
> > Ok there is a
> > casting. Try to modify like this :
> >
> > *read_buff_ptr = 0;
>
> Ah, of course. It compiles with the changes below.
>
> Now, why was the line number in the error message
> off
> by one and is it possible to include a variable name
> or something in the error message to give the user
> more information if this were a more complex
> statement?
>
> -Charles
>
> --- nano.c~ 2003-12-27 09:35:21.000000000 -0700
> +++ nano.c 2004-11-17 02:41:04.000000000 -0700
> @@ -1803,7 +1803,7 @@
>
> }
>
> - *read_buff_ptr = (char)NULL;
> + *read_buff_ptr = 0;
> close(uniq_fd[0]);
>
> /* Process the spelling errors */
> @@ -1812,7 +1812,7 @@
> while (*read_buff_ptr != '\0') {
>
> if ((*read_buff_ptr == '\n') ||
> (*read_buff_ptr == '\r')) {
> - *read_buff_ptr = (char)NULL;
> + *read_buff_ptr = 0;
> if (read_buff_word != read_buff_ptr) {
> if
> (!do_int_spell_fix(read_buff_word))
> {
> read_buff_word = read_buff_ptr;
>
>
>