[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: [Tinycc-devel] Several patchs from Debian packaging]

From: grischka
Subject: [Fwd: Re: [Tinycc-devel] Several patchs from Debian packaging]
Date: Sun, 18 Apr 2010 10:18:36 +0200
User-agent: Thunderbird (Windows/20090812)

Forwarded to the mailing list.

--- grischka

-------- Original Message --------
Subject: Re: [Tinycc-devel] Several patchs from Debian packaging
Date: Sun, 18 Apr 2010 06:40:47 +0200
From: RoboTux <address@hidden>
Reply-To: address@hidden
To: grischka <address@hidden>
References: <address@hidden> <address@hidden>

Le samedi 17 avril 2010 22:59:55, vous avez écrit :
Thanks for your work.  Some comments on the pushed patches:

RoboTux wrote:
> [P|8de9b7a] Correctly support all unary expression with sizeof
> Unary expression can start with a parenthesis. Thus, the current test
> to detect which sizeof form is being parsed is inaccurate. This patch
> makes tcc able to handle things like sizeof (x)[1] where x is declared
> as char x[5]; wich is a valid unary expression

"vtop_saved" is never used.

Oups, some trace of older tries.

> [P|47abdbd] Better handle ld scripts
> * search file from INPUT and GROUP commands in the library path in
> addition to the current directory
> * handle libraries specified by -lfoo options
> * Search lib in GROUP command repeatedly

   +static int new_undef_sym = 0;

Variables (in particular static ones) should be in the file where
they are used.  tcc.h should have prototypes only.
Ok, I'll make a new commit tomorrow.

   +    ext = strrchr(base, '.');

We have "tcc_fileextension(name)" for that.

I know, but there was one difference which make me decide not to use it. I took
that code from tcc_fileextension.

   +        snprintf(filename, strlen(libname) + 5, "%s.def", libname);

It is pointless to use snprintf this way.  Use just sprintf.
I agree.

   static int filename_to_libname(TCCState *s1, char filename[], char

"libname" should be const (because it is "input only").
I agree again.

   *(--ext) = '\0';
   strcpy(libname, filename);
   *ext = '.';

That's ugly.
Ok, I prefer this code because it requires less lines that the other way I
wanted to do this. I'll post the other version here before commiting it.

   +                if (ret)
   +                    goto free_bufstate;
   +                while (!ret && new_undef_syms()) {
   +                    tcc_load_buffer_state(buf_state, off);
   +                    ret = ld_add_file_list(s1, 0);
   +                }
   +                free_bufstate:

The first two lines here are redundant.
OMG, how did I miss that.

In any case the "save_buffer_state" idea that abuses the reader to
resolve forward library symbols is horrible.  Maybe you can put the
library-names in a list (aka dynarray) and then just loop over that
That's the first try I did but the code seems ugly to me. Not the principle,
but just the resulting code in add_ld_file_list. I'll do better but probably
not before next WE.

> [P|e9406c0] Complain for static fct declared w/o file scope
> Error out on static function without file scope and give an explaination
> to the user

Probably too correct.  It's not an error with GCC and also breaks
compilation of some older code I use for testing.
Really ? Because I did have an error with gcc with the folllowing code:

void a()
        static void b();

static void b()

 Submitted for bug #170105 in Debian (http://bugs.debian.org/cgi-

--- grischka

Best regards,

Thomas Preud'homme

reply via email to

[Prev in Thread] Current Thread [Next in Thread]