Re: [Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2015-01-07 Thread Sergey Korshunoff
I'm agree. But what to do with the described bug? How to fix it?

cd tcc-source
./configure --cc=tcc; make; make install; make test
tcc -o tcctest.cc tcctest.c -I.. -I..  -w  -DTCC_TARGET_I386
-std=gnu99 -O0 -fno-omit-frame-pointer
tcc: error: invalid option -- '-std=gnu99'


2015-01-07 9:08 GMT+03:00, Michael Matz matz@frakked.de:
 Am 07.01.2015 um 04:14 schrieb Sergey Korshunoff:

 After applying a disable DTEST patch to allow make test  to pass a
 broken tests...
 ./configure --cc=tcc; make; make install; make test
 tcc -o tcctest.cc tcctest.c -I.. -I..  -w  -DTCC_TARGET_I386
 -std=gnu99 -O0 -fno-omit-frame-pointer
 tcc: error: invalid option -- '-std=gnu99'

 With a patch apllied a test can be performed with
 make CFLAGS=-Wunsuported test

 And your solution?

 The makefile (and/or configure) needs to be fixed to not hardcode
 potentially unknown compiler options.

 What you will add to CFLAGS?

 Nothing.  The only sensible thing that tcc can to with completely
 unknown options is to error out on them.  It can't simply ignore them,
 not even with a warning as the unknown option in question might have
 significant effects for code generation for a compiler understanding it
 (-std=gnu99 is on the border of being such option) and the author might
 _require_ that effect to happen for his compilations.  Ignoring it would
 either generate unnecessary followup errors or silently generate code
 with the wrong semantics, which is worse.

 There is a case to be made to only warn for unknown options that
 influence diagnostics only.  As it's unknown it's of course hard to know
 when exactly that is the case.  If it starts with -W that might be a
 good enough heuristic in practice, so I'm with Thomas on this topic.

 If you absolutely hate fixing makefiles/configures for trying out tcc,
 instead of patching tcc to ignore all unkown options you could also
 simply write a wrapper script that removes _known_ unknown options that
 you happen to hit when you know they indeed aren't important.


 Ciao,
 Michael.

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


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


Re: [Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2015-01-07 Thread Michael Matz

Am 07.01.2015 um 11:22 schrieb Sergey Korshunoff:

I'm agree. But what to do with the described bug? How to fix it?

cd tcc-source
./configure --cc=tcc; make; make install; make test
tcc -o tcctest.cc tcctest.c -I.. -I..  -w  -DTCC_TARGET_I386
-std=gnu99 -O0 -fno-omit-frame-pointer
tcc: error: invalid option -- '-std=gnu99'


Multiple solutions:
* declare this a non-problem by requiring that the reference compiler
  in the testsuite has to be GCC (in that case configure could perhaps
  error out if CC != tcc).
* if tcc is to be accepted as test reference then the Makefile and
  possibly configure need to be changed to not pass -std=gnu99 to it
  without checking if it is accepted (I don't have tcc code here to say
  if it's only the Makefile that hardcodes that option, or if it comes
  from configure).


Ciao,
Michael.

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


Re: [Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2015-01-06 Thread Sergey Korshunoff
 That would avoid rewriting the Makefile to only add switches to CFLAGS that 
 are supported by the compiler as it should have been done ;-) (no blame, we 
 all do this).

After applying a disable DTEST patch to allow make test  to pass a
broken tests...
   ./configure --cc=tcc; make; make install; make test
tcc -o tcctest.cc tcctest.c -I.. -I..  -w  -DTCC_TARGET_I386
-std=gnu99 -O0 -fno-omit-frame-pointer
tcc: error: invalid option -- '-std=gnu99'

With a patch apllied a test can be performed with
   make CFLAGS=-Wunsuported test

And your solution? What you will add to CFLAGS?


2015-01-05 0:01 GMT+03:00, RoboTux robo...@celest.fr:
 Le 2015-01-04 04:42, Sergey Korshunoff a écrit :
 GCC and clang also error out for unknown option. What option caused
 your
 program to fail to compile?

 The patch is for the case with -Wunsupported. In such case a user will
 is Don't trap, only warning. There are many gcc options which tcc
 don't support. But in many cases, this options are not important.
 Changing a Makefiles is not a solution when trying to use tcc insteed
 of gcc.
 And a patch test command is:
  /tcc -Wunsupported -traditional -E tcc.c -o tcc.i

 I'd prefer a patch that just gives a warning for unknown -W option. It
 would be just like if the detection was really bad. Doing the same for
 other options would be more risky IMHO. That would avoid rewriting the
 Makefile to only add switches to CFLAGS that are supported by the
 compiler as it should have been done ;-) (no blame, we all do this).

 Best regards,

 Thomas


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


Re: [Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2015-01-06 Thread Michael Matz

Am 07.01.2015 um 04:14 schrieb Sergey Korshunoff:


After applying a disable DTEST patch to allow make test  to pass a
broken tests...
./configure --cc=tcc; make; make install; make test
tcc -o tcctest.cc tcctest.c -I.. -I..  -w  -DTCC_TARGET_I386
-std=gnu99 -O0 -fno-omit-frame-pointer
tcc: error: invalid option -- '-std=gnu99'

With a patch apllied a test can be performed with
make CFLAGS=-Wunsuported test

And your solution?


The makefile (and/or configure) needs to be fixed to not hardcode 
potentially unknown compiler options.



What you will add to CFLAGS?


Nothing.  The only sensible thing that tcc can to with completely 
unknown options is to error out on them.  It can't simply ignore them, 
not even with a warning as the unknown option in question might have 
significant effects for code generation for a compiler understanding it 
(-std=gnu99 is on the border of being such option) and the author might 
_require_ that effect to happen for his compilations.  Ignoring it would 
either generate unnecessary followup errors or silently generate code 
with the wrong semantics, which is worse.


There is a case to be made to only warn for unknown options that 
influence diagnostics only.  As it's unknown it's of course hard to know 
when exactly that is the case.  If it starts with -W that might be a 
good enough heuristic in practice, so I'm with Thomas on this topic.


If you absolutely hate fixing makefiles/configures for trying out tcc, 
instead of patching tcc to ignore all unkown options you could also 
simply write a wrapper script that removes _known_ unknown options that 
you happen to hit when you know they indeed aren't important.



Ciao,
Michael.

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


Re: [Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2015-01-05 Thread Sergey Korshunoff
 I'd prefer a patch that just gives a warning for unknown -W option.

And how about the test case:
  tcc -Wunsupported -traditional -E tcc.c -o tcc.i
What is purpose of the -Wunsupported ? How to tell a tcc don't break a
compilation process if there is an unknown option? Consider a
compilation of the linux kernel.


2015-01-05 0:01 GMT+03:00, RoboTux robo...@celest.fr:
 Le 2015-01-04 04:42, Sergey Korshunoff a écrit :
 GCC and clang also error out for unknown option. What option caused
 your
 program to fail to compile?

 The patch is for the case with -Wunsupported. In such case a user will
 is Don't trap, only warning. There are many gcc options which tcc
 don't support. But in many cases, this options are not important.
 Changing a Makefiles is not a solution when trying to use tcc insteed
 of gcc.
 And a patch test command is:
  /tcc -Wunsupported -traditional -E tcc.c -o tcc.i

 I'd prefer a patch that just gives a warning for unknown -W option. It
 would be just like if the detection was really bad. Doing the same for
 other options would be more risky IMHO. That would avoid rewriting the
 Makefile to only add switches to CFLAGS that are supported by the
 compiler as it should have been done ;-) (no blame, we all do this).

 Best regards,

 Thomas


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


Re: [Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2015-01-03 Thread Thomas Preud'homme
Le samedi 27 décembre 2014, 17:02:03 Sergey Korshunoff a écrit :
 # ./tcc -Wunsupported -traditional -E tcc.c -o tcc.i
 tcc: error: invalid option -- '-traditional'
 
 Don't break compilation process with unknow option  (-traditional for
 example). There is a warning label for such case.

GCC and clang also error out for unknown option. What option caused your 
program to fail to compile?

Best regards,

Thomas

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


[Tinycc-devel] [PATCH] Don't break compilation process with unknow option

2014-12-27 Thread Sergey Korshunoff
# ./tcc -Wunsupported -traditional -E tcc.c -o tcc.i
tcc: error: invalid option -- '-traditional'

Don't break compilation process with unknow option  (-traditional for
example). There is a warning label for such case.


2014-12-27-03-warn-inv-ooption.patch
Description: Binary data
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel