Re: [Tinycc-devel] Request push

2014-07-02 Thread Thomas Preud'homme
Le mercredi 02 juillet 2014, 00:07:02 jiang a écrit :
> I'm sorry, I was remiss.
> I did not find a space with gitk.
> This is my new commit:89000c18dc7d5ccb2687948f94fe49d392990dab

That's great. Thanks. For the ";;;" patch I won't be able to review for 2 
weeks as I'll be away from my computer. See if you can find someone else to 
review or else wait for my return.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-07-01 Thread jiang

I'm sorry, I was remiss.
I did not find a space with gitk.
This is my new commit:89000c18dc7d5ccb2687948f94fe49d392990dab


Best regards,

Jiang


Le dimanche 29 juin 2014, 16:56:31 Thomas Preud'homme a écrit :

Le dimanche 29 juin 2014, 12:32:57 大熊猫 a écrit :

Thank you Thomas, I hope you agree with my request.

Sure, as I said, provided that a testcase is added I'd be happy for you to
commit the patch.

Thanks for committing the patch Jiang. I have one comment: you should use a
different name for your testcase as you are not testing the concatenation. You
should name your tests macro_param_list or something like this.

Also a minor nitpick: you left a trailing whitespace in both testcase in the
line "int c = 0xa; ". It's not worth a commit in itself but since you will do
a commit to rename the test, please fix it at the same time. Before you push I
urge you to look at your diff with git. It will show you trailing whitespace by
default (if not you can activate it with git config --global core.whitespace
trailing-space,blank-at-eol,space-before-tab,blank-at-eof).

Best regards,

Thomas





___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-07-01 Thread Thomas Preud'homme
Le dimanche 29 juin 2014, 16:56:31 Thomas Preud'homme a écrit :
> Le dimanche 29 juin 2014, 12:32:57 大熊猫 a écrit :
> > Thank you Thomas, I hope you agree with my request.
> 
> Sure, as I said, provided that a testcase is added I'd be happy for you to
> commit the patch.

Thanks for committing the patch Jiang. I have one comment: you should use a 
different name for your testcase as you are not testing the concatenation. You 
should name your tests macro_param_list or something like this.

Also a minor nitpick: you left a trailing whitespace in both testcase in the 
line "int c = 0xa; ". It's not worth a commit in itself but since you will do 
a commit to rename the test, please fix it at the same time. Before you push I 
urge you to look at your diff with git. It will show you trailing whitespace by 
default (if not you can activate it with git config --global core.whitespace 
trailing-space,blank-at-eol,space-before-tab,blank-at-eof).

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-06-30 Thread Thomas Preud'homme
Le lundi 30 juin 2014, 16:49:02 jiang a écrit :
> Struct improved algorithms and add struct warnings and other warnings.

Hi Jiang,

> 
> The following can be compiled:
> struct st{int a;;;};
> 
> If you do not have advice, tomorrow pushed into the mob.

No Jiang, that's not how it works. There is several problem with this request:

1) You need to realize that we are all volunteer spending some of our free 
time to improve tcc. We don't necessarily check emails about tcc everyday and 
anyway 1 day is too short to review. Another consequence of this is that we 
don't have to answer within a given delay. We will do our best to answer but 
you just need to wait. Of course if too much time (like 2 weeks) pass without 
answer you can ping to ask if we saw your email. And finally I think in your 
case you should not commit without an approval first. Eventually, when your 
commit will start to improve we might tell you that you don't need to ask for 
a review anymore.

2) I gave you some comments on another patch. Before asking for another review 
you could maybe post a new version that fixes all my comments. It gives the 
feeling that you don't want to address the remarks and discourages people to 
review your patches.

3) Don't bundle several changes in one patch. It makes it more difficult to 
review. So you make one patch that fixes the bug you mentions and others (or 
maybe just one other, it depends how big it is) with the warnings

4) Your patch contains some formatting issues:

+if (v == 0 && (type1.t & VT_BTYPE) != VT_STRUCT){
+tcc_warning("declaration does not declare 
anything");
+break;
+}if (type_size(&type1, &align) < 0) {
+if ((a == TOK_STRUCT) && (type1.t & VT_ARRAY))
+flexible = 1;
+else
+tcc_error("field '%s' has incomplete type", 
get_tok_str(v, NULL));
 }

There should be a space between the closing parenthesis ')' and the opening 
curly brace '{'. The second "if" should be on a new line or should be preceded 
by a "else"

5) The commit message is not very informative. For the commit with the bugfix 
you could say "Allow tcc to parse:" and then the example. See commit 
82969f045c99b4d1ef833de35117c17b326b46c0 for an example. You can also simply 
explain what bug you fix "Fix parsing of arbitrary number of semicolons" or 
something better and that brings me to the next comment.

6) You need to understand how a language is designed.

-parse_btype(&btype, &ad);
+if(!parse_btype(&btype, &ad)){
+if (tok == ';'){
+skip(';');
+continue;

Here you are saying that it's ok to have struct st {int a;} but not struct 
st {int a:10}. A better place to add such a check would be near the end of 
the function, around the "skip(';'). You need to understand why this is 
authorized. So as an exercise grab the C99 standard at [1] and tell me why 
this is authorized. Hint: start to read from section 6.7.2.1. Definitions are 
recursive, so you need to browse quite a lot to understand things. Try to tell 
me which lexical elements to follow (sorry, I don't know the proper term, 
shame on me) to create your testcase. Something like:

struct-or-union-specifier
  -> struct-or-union
  -> identifier (no need to detail here)
  -> struct-declaration-list
 -> struct-declaration

etc…

[1] http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-06-30 Thread jiang

Struct improved algorithms and add struct warnings and other warnings.

The following can be compiled:
struct st{int a;;;};

If you do not have advice, tomorrow pushed into the mob.

jiang
commit 8be2fbd82ef16c8f846fccb46689827ed37997eb
Author: jiang <30155...@qq.com>
Date:   Mon Jun 30 16:40:16 2014 +0800

Add warning

diff --git a/libtcc.c b/libtcc.c
index 7caa7c1..79a2d2c 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1397,8 +1397,9 @@ static const FlagDef warning_defs[] = {
 { offsetof(TCCState, warn_unsupported), 0, "unsupported" },
 { offsetof(TCCState, warn_write_strings), 0, "write-strings" },
 { offsetof(TCCState, warn_error), 0, "error" },
-{ offsetof(TCCState, warn_implicit_function_declaration), WD_ALL,
-  "implicit-function-declaration" },
+{ offsetof(TCCState, warn_implicit_function_declaration), WD_ALL, 
"implicit-function-declaration" },
+{ offsetof(TCCState, warn_return_type), WD_ALL, "return-type" },
+{ offsetof(TCCState, warn_char_subscripts), WD_ALL, "char-subscripts" },
 };
 
 ST_FUNC int set_flag(TCCState *s, const FlagDef *flags, int nb_flags,
diff --git a/tcc.h b/tcc.h
index c93cedf..596b22f 100644
--- a/tcc.h
+++ b/tcc.h
@@ -594,6 +594,8 @@ struct TCCState {
 int warn_error;
 int warn_none;
 int warn_implicit_function_declaration;
+int warn_return_type;
+int warn_char_subscripts;
 
 /* compile with debug symbol (and use them if error during execution) */
 int do_debug;
diff --git a/tccgen.c b/tccgen.c
index 1a89d4a..227864e 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2898,42 +2898,47 @@ static void struct_decl(CType *type, int u, int tdef)
 offset = 0;
 flexible = 0;
 while (tok != '}') {
-parse_btype(&btype, &ad);
+if(!parse_btype(&btype, &ad)){
+if (tok == ';'){
+skip(';');
+continue;
+}else if(tok == TOK_EOF || tok == '{')
+expect("specifier-qualifier-list at end of input");
+}
 while (1) {
-   if (flexible)
-   tcc_error("flexible array member '%s' not at the end of 
struct",
-  get_tok_str(v, NULL));
+if (flexible)
+tcc_error("flexible array member '%s' not at the end 
of struct", get_tok_str(v, NULL));
 bit_size = -1;
 v = 0;
 type1 = btype;
 if (tok != ':') {
 type_decl(&type1, &ad, &v, TYPE_DIRECT | 
TYPE_ABSTRACT);
-if (v == 0 && (type1.t & VT_BTYPE) != VT_STRUCT)
-expect("identifier");
-if (type_size(&type1, &align) < 0) {
-   if ((a == TOK_STRUCT) && (type1.t & VT_ARRAY) && c)
-   flexible = 1;
-   else
-   tcc_error("field '%s' has incomplete type",
-  get_tok_str(v, NULL));
+if (v == 0 && (type1.t & VT_BTYPE) != VT_STRUCT){
+tcc_warning("declaration does not declare 
anything");
+break;
+}if (type_size(&type1, &align) < 0) {
+if ((a == TOK_STRUCT) && (type1.t & VT_ARRAY))
+flexible = 1;
+else
+tcc_error("field '%s' has incomplete type", 
get_tok_str(v, NULL));
 }
 if ((type1.t & VT_BTYPE) == VT_FUNC ||
 (type1.t & (VT_TYPEDEF | VT_STATIC | VT_EXTERN | 
VT_INLINE)))
-tcc_error("invalid type for '%s'", 
-  get_tok_str(v, NULL));
+tcc_error("invalid type for '%s'", get_tok_str(v, 
NULL));
 }
 if (tok == ':') {
 next();
 bit_size = expr_const();
 /* XXX: handle v = 0 case for messages */
 if (bit_size < 0)
-tcc_error("negative width in bit-field '%s'", 
-  get_tok_str(v, NULL));
+tcc_error("negative width in bit-field '%s'", 
get_tok_str(v, NULL));
 if (v && bit_size == 0)
-tcc_error("zero width for bit-field '%s'", 
-  get_tok_str(v, NULL));
+tcc_error("zero width for bit-field '%s'", 
get_tok_str(v, NULL));
 }
-size = type_size(&type1, &align);
+if(type1.t & VT_VLA)
+size = 0, align = 1;
+   

Re: [Tinycc-devel] Request push

2014-06-29 Thread jiang
I have other patches, but their ideas are not very mature, and later 
pushed to give you.


jiang
于 2014年06月29日 16:56, Thomas Preud'homme 写道:

Le dimanche 29 juin 2014, 12:32:57 大熊猫 a écrit :

Thank you Thomas, I hope you agree with my request.

Sure, as I said, provided that a testcase is added I'd be happy for you to
commit the patch.


I'll change it a warning message, and then add some tests, along with a push
up!

Great.
  

"Not follow GCC blindly."
I was too blind! I'm not very familiar with C99, but I think there is a lot
to learn from GCC place!

There are two reasons for that, the first is that GCC also has bugs and the
second is that sometimes GCC deviates from the standard, especially if you
don't specify -std=c99 of course. In this case, the correct behavior is defined
it section 6.10.3 in the definition of the function-like macro. It says that
it's a left parenthesis followed by an arbitrary number of identifier. Earlier
in the document (section 6.4.2.1) an identifier is defined and it cannot contain
any parenthesis, only digit, letters from in the range a-zA-Z, underscore
('_') and universal character (basically non ascii character with no ambiguity
with any of those used in the language).
  

jiang

   > I'll push a patch.

Please post the result before and I'll happily give you green light.

Eventually, after a certain number of good patches you will be welcome to
commit directly.

Best regards,

Thomas


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-06-29 Thread Thomas Preud'homme
Le dimanche 29 juin 2014, 12:32:57 大熊猫 a écrit :
> Thank you Thomas, I hope you agree with my request. 

Sure, as I said, provided that a testcase is added I'd be happy for you to 
commit the patch.

> I'll change it a warning message, and then add some tests, along with a push
> up! 

Great.
 
> "Not follow GCC blindly." 
> I was too blind! I'm not very familiar with C99, but I think there is a lot
> to learn from GCC place!

There are two reasons for that, the first is that GCC also has bugs and the 
second is that sometimes GCC deviates from the standard, especially if you 
don't specify -std=c99 of course. In this case, the correct behavior is defined 
it section 6.10.3 in the definition of the function-like macro. It says that 
it's a left parenthesis followed by an arbitrary number of identifier. Earlier 
in the document (section 6.4.2.1) an identifier is defined and it cannot 
contain 
any parenthesis, only digit, letters from in the range a-zA-Z, underscore 
('_') and universal character (basically non ascii character with no ambiguity 
with any of those used in the language).
 
> jiang
> 
>   > I'll push a patch.

Please post the result before and I'll happily give you green light.

Eventually, after a certain number of good patches you will be welcome to 
commit directly.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Request push

2014-06-28 Thread ??????
Thank you Thomas, I hope you agree with my request. 
I'll change it a warning message, and then add some tests, along with a push 
up! 

"Not follow GCC blindly." 
I was too blind! I'm not very familiar with C99, but I think there is a lot to 
learn from GCC place!
 
jiang
  > I'll push a patch.

I'll take this as "I'd like to commit/push this patch, what do you think of 
it?"

The patch itself looks good but it would be better if you add a testcase that 
would fail without your patch. You already have a program that exhibit the 
bug, you just need to transform it so that it returns 0 if tcc behaves 
correctly and 1 else.

I also have a minor nitpick: "\'%s\' may not appear in parameter list", 
get_tok_str(var, NULL)

That is, use single quote and put the symbol at the beginning of the sentence, 
that would avoid the colon.

If you fix those (testcase is very important), you are welcome to commit/push 
your patch.

In the future it would be better if you provide a patch as given by git 
format-patch. This way we'd have the message that you intend to use in your 
commit. And finally please try to find a title more specific than "Request 
push". 
Try to find a title that explain what you want to fix. In this case you could 
choose "Fix identifier list parsing". If you can refer to a section in C99 
standard in your message and your commit message that's the icing on the cake 
but we don't do it systematically ourselves. However I think it is good 
practice as GCC can sometimes deviate from the standard and we should try to 
adhere to the standard, not follow GCC blindly.

Thanks for your patch.

Best regards,

Thomas___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-06-28 Thread Thomas Preud'homme
Le lundi 23 juin 2014, 23:56:10 jiang a écrit :
> I'll push a patch.

I'll take this as "I'd like to commit/push this patch, what do you think of 
it?"

The patch itself looks good but it would be better if you add a testcase that 
would fail without your patch. You already have a program that exhibit the 
bug, you just need to transform it so that it returns 0 if tcc behaves 
correctly and 1 else.

I also have a minor nitpick: "\'%s\' may not appear in parameter list", 
get_tok_str(var, NULL)

That is, use single quote and put the symbol at the beginning of the sentence, 
that would avoid the colon.

If you fix those (testcase is very important), you are welcome to commit/push 
your patch.

In the future it would be better if you provide a patch as given by git 
format-patch. This way we'd have the message that you intend to use in your 
commit. And finally please try to find a title more specific than "Request 
push". 
Try to find a title that explain what you want to fix. In this case you could 
choose "Fix identifier list parsing". If you can refer to a section in C99 
standard in your message and your commit message that's the icing on the cake 
but we don't do it systematically ourselves. However I think it is good 
practice as GCC can sometimes deviate from the standard and we should try to 
adhere to the standard, not follow GCC blindly.

Thanks for your patch.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Request push

2014-06-23 Thread jiang

I'll push a patch.

bug:

--
#define hexCh(c (c >= 10 ? 'a' + c - 10 : '0' + c)
  hexCh(c);

out:
jiang@jiang:~/test$ ./tcc -E c4.c
# 1 "c4.c"

(c >= 10 ? 'a' + c - 10 : '0' + c);
---

#define hexCh(c/3) (c >= 10 ? 'a' + c - 10 : '0' + c)
hexCh(c);

out:
jiang@jiang:~/test$ ./tcc -E c4.c
# 1 "c4.c"

/3) (c >= 10 ? 'a' + c - 10 : '0' + c);
jiang@jiang:~/test$

after patch:

# 1 "c4.c"
c4.c:1: error: may not appear in macro parameter list: "("
jiang@jiang:~/test$



jiang@jiang:~/test$ ./tcc -E c4.c
# 1 "c4.c"
c4.c:1: error: may not appear in macro parameter list: "/"
jiang@jiang:~/test$



-
g...@gitcafe.com:weixiao/tinycc.git

Thank you for reminding

jiang

? 2014?06?23? 09:50, tinycc-devel-requ...@nongnu.org ??:

Hey jiang,

For each of these three patches, please explain the following:

1) When run with the version of tcc without your patch, what behavior 
do you get? What does the C99 spec tell us we should get?

2) How does the proposed patch alter the behavior of tcc?

Also, it appears you did not read the links I provided about how to 
write good commit messages. Please re-read those and write better ones.


Thanks!
David


On Sun, Jun 22, 2014 at 3:41 AM, jiang <30155...@qq.com 
> wrote:


Here is a patch to push
I hope to help you.

jiang

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org 
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

" tinycc is a great project, and I am honored to join a project  "
commit 87373cd0ec7f5b0c0de77565090bf9710d7107a0
Author: jiang <30155...@qq.com>
Date:   Mon Jun 16 16:43:40 2014 +0800

#define bug fixes
bug:
#define hexCh(c (c >= 10 ? 'a' + c - 10 : '0' + c)
hexCh(c);

diff --git a/tccpp.c b/tccpp.c
index 053fd57..dfbc857 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1253,16 +1253,15 @@ ST_FUNC void parse_define(void)
 next_nomacro();
 }
 if (varg < TOK_IDENT)
-tcc_error("badly punctuated parameter list");
+tcc_error("may not appear in macro parameter list: \"%s\"", 
get_tok_str(varg, NULL));
 s = sym_push2(&define_stack, varg | SYM_FIELD, is_vaargs, 0);
 *ps = s;
 ps = &s->next;
 if (tok != ',')
-break;
+continue;
 next_nomacro();
 }
-if (tok == ')')
-next_nomacro_spc();
+next_nomacro_spc();
 t = MACRO_FUNC;
 }
 tok_str_new(&str);
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-06-23 Thread Michael Matz

Hi,

On Sun, 22 Jun 2014, David Mertens wrote:


Hey jiang,
For each of these three patches, please explain the following:

1) When run with the version of tcc without your patch, what behavior do you
get? What does the C99 spec tell us we should get?
2) How does the proposed patch alter the behavior of tcc?

Also, it appears you did not read the links I provided about how to write
good commit messages. Please re-read those and write better ones.


Patch 2 at least also contains gratious whitespace changes creating lines 
longer than 80 character (I know, not a strict policy for TCC, but 
existing code mostly follows that).  And patch 3 (the bitfield fiddling) 
certainly is wrong as explained in some other mail.



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Request push

2014-06-22 Thread David Mertens
Hey jiang,

For each of these three patches, please explain the following:

1) When run with the version of tcc without your patch, what behavior do
you get? What does the C99 spec tell us we should get?
2) How does the proposed patch alter the behavior of tcc?

Also, it appears you did not read the links I provided about how to write
good commit messages. Please re-read those and write better ones.

Thanks!
David


On Sun, Jun 22, 2014 at 3:41 AM, jiang <30155...@qq.com> wrote:

> Here is a patch to push
> I hope to help you.
>
> jiang
>
> ___
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>


-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Request push

2014-06-22 Thread jiang

Here is a patch to push
I hope to help you.

jiang
commit 512947a3cc497cee5e4f5c0aa3f17f81fa2bb18b
Author: jiang <30155...@qq.com>
Date:   Mon Jun 16 16:43:40 2014 +0800

#define bug fixes
bug:
#define hexCh(c (c >= 10 ? 'a' + c - 10 : '0' + c)
hexCh(c);

diff --git a/tccpp.c b/tccpp.c
index 053fd57..dfbc857 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1253,16 +1253,15 @@ ST_FUNC void parse_define(void)
 next_nomacro();
 }
 if (varg < TOK_IDENT)
-tcc_error("badly punctuated parameter list");
+tcc_error("may not appear in macro parameter list: \"%s\"", 
get_tok_str(varg, NULL));
 s = sym_push2(&define_stack, varg | SYM_FIELD, is_vaargs, 0);
 *ps = s;
 ps = &s->next;
 if (tok != ',')
-break;
+continue;
 next_nomacro();
 }
-if (tok == ')')
-next_nomacro_spc();
+next_nomacro_spc();
 t = MACRO_FUNC;
 }
 tok_str_new(&str);
commit 588794e66871c1042ab96a644b0da19681268e78
Author: jiang <30155...@qq.com>
Date:   Sun Jun 22 15:28:34 2014 +0800

Add warning

diff --git a/libtcc.c b/libtcc.c
index d761582..0f8477c 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1404,8 +1404,9 @@ static const FlagDef warning_defs[] = {
 { offsetof(TCCState, warn_unsupported), 0, "unsupported" },
 { offsetof(TCCState, warn_write_strings), 0, "write-strings" },
 { offsetof(TCCState, warn_error), 0, "error" },
-{ offsetof(TCCState, warn_implicit_function_declaration), WD_ALL,
-  "implicit-function-declaration" },
+{ offsetof(TCCState, warn_implicit_function_declaration), WD_ALL, 
"implicit-function-declaration" },
+{ offsetof(TCCState, warn_return_type), WD_ALL, "return-type" },
+{ offsetof(TCCState, warn_char_subscripts), WD_ALL, "char-subscripts" },
 };
 
 ST_FUNC int set_flag(TCCState *s, const FlagDef *flags, int nb_flags,
diff --git a/tcc.h b/tcc.h
index d0859d3..5cf639f 100644
--- a/tcc.h
+++ b/tcc.h
@@ -601,6 +601,8 @@ struct TCCState {
 int warn_error;
 int warn_none;
 int warn_implicit_function_declaration;
+int warn_return_type;
+int warn_char_subscripts;
 
 /* compile with debug symbol (and use them if error during execution) */
 int do_debug;
diff --git a/tccgen.c b/tccgen.c
index b2a7717..f134586 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2927,13 +2927,12 @@ static void struct_decl(CType *type, int u, int tdef)
 if (tok != ':') {
 type_decl(&type1, &ad, &v, TYPE_DIRECT | 
TYPE_ABSTRACT);
 if (v == 0 && (type1.t & VT_BTYPE) != VT_STRUCT)
-expect("identifier");
+expect("specifier-qualifier-list at end of input");
 if (type_size(&type1, &align) < 0) {
-   if ((a == TOK_STRUCT) && (type1.t & VT_ARRAY))
-   flexible = 1;
-   else
-   tcc_error("field '%s' has incomplete type",
-  get_tok_str(v, NULL));
+if ((a == TOK_STRUCT) && (type1.t & VT_ARRAY))
+flexible = 1;
+else
+tcc_error("field '%s' has incomplete type", 
get_tok_str(v, NULL));
 }
 if ((type1.t & VT_BTYPE) == VT_FUNC ||
 (type1.t & (VT_TYPEDEF | VT_STATIC | VT_EXTERN | 
VT_INLINE)))
@@ -2945,13 +2944,14 @@ static void struct_decl(CType *type, int u, int tdef)
 bit_size = expr_const();
 /* XXX: handle v = 0 case for messages */
 if (bit_size < 0)
-tcc_error("negative width in bit-field '%s'", 
-  get_tok_str(v, NULL));
+tcc_error("negative width in bit-field '%s'", 
get_tok_str(v, NULL));
 if (v && bit_size == 0)
-tcc_error("zero width for bit-field '%s'", 
-  get_tok_str(v, NULL));
+tcc_error("zero width for bit-field '%s'", 
get_tok_str(v, NULL));
 }
-size = type_size(&type1, &align);
+if(type1.t & VT_VLA)
+size = 0, align = 1;
+else
+size = type_size(&type1, &align);
 if (ad.a.aligned) {
 if (align < ad.a.aligned)
 align = ad.a.aligned;
@@ -3041,13 +3041,18 @@ static void struct_decl(CType *type, int u, int tdef)
 *ps = ss;
 ps = &ss->next;
 }
-if (tok == ';' || tok ==