Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Michael Matz

Hi,

On Sun, 24 Apr 2016, Sergey Korshunoff wrote:


Hi!
https://github.com/seyko2/tinycc/commit/086ae74b696b7e2a73980bd852516b84251bd553

don't accept 0x123e-3 float format. This allow to compile
tccboot kernel with a macro expansion like
   __asm__( "pushl $""0xfe""-256\n\t" );


No, simply fix the TCC bug.  0xfe+1 (and similar) simply is no valid 
token.  Look at parse_number for inspiration (hint: remember the base and 
accept 'e'/'E' only if base is 10).



Ciao,
Michael.

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Edmund Grimley Evans
Sergey:

> PS: is it allowed to disable hex float format in asm file/string?

It probably makes sense to use a different tokeniser for assembler,
but the problem isn't "hex float format". A hexadecimal floating
constant in C contains a 'p' or 'P', like "0xfep1"; "0xfe+1" is a
preprocessor token (a "pp-number") that isn't a valid token.

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Sergey Korshunoff
>> Some time before I have troubles compiling 2.4.26 code with tcc.

>Which version of TCC, and were you just compiling with TCC, or were
>you preprocessing with TCC and then trying to compile the preprocessed
>file?

I can't remember. I simply added spaces.

PS: is it allowed to disable hex float format in asm file/string?

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Edmund Grimley Evans
> Some time before I have troubles compiling 2.4.6 code with tcc.

Which version of TCC, and were you just compiling with TCC, or were
you preprocessing with TCC and then trying to compile the preprocessed
file?

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Sergey Korshunoff
> Are you suggesting that some versions of GCC or TCC don't compile that
> code?

linux/include/acpi/
actypes.h
#define ACPI_TYPE_INVALID  0x1E

acglobal.h
#define NUM_NS_TYPES  ACPI_TYPE_INVALID+1 // 2.4.26
#define NUM_NS_TYPES  ACPI_TYPE_INVALID+1 // 2.6.18
#define ACPI_NUM_NS_TYPES  (ACPI_TYPE_INVALID + 1) // 2.6.32

Some time before I have troubles compiling 2.4.6 code with tcc.

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Edmund Grimley Evans
Sergey:

> My first attempt was to disable such format in asm files/strings. But
> as I remember, the
> same problem was with a C like
>  #define NR_SLOTS 0xfe
>  int array[NR_SLOTS-1];
> 
> Some gcc versions don't support hex float notation and compile such code fine.

Are you suggesting that some versions of GCC or TCC don't compile that
code?

Ah, perhaps you're trying to compile the output of TCC's preprocessor.
It's an old bug in TCC that it fails to put a space between the tokens.

Edmund

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Sergey Korshunoff
> My first attempt was to disable such format in asm files/strings.
https://github.com/seyko2/tinycc/commit/f2f01c4c25be72de7266973ea80489a529f81ab3

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Sergey Korshunoff
> However, it may be that GCC puts
> the preprocessor into a special mode when preprocessing a .s file.
> Please investigate and report back!

No, preprocessed files are identical. Then it looks that "as" don't
allow/accept by default such float format

> In any case, TCC does not need, and should not have, a
"-fno-hex-floats option" option.

My first attempt was to disable such format in asm files/strings. But
as I remember, the
same problem was with a C like
 #define NR_SLOTS 0xfe
 int array[NR_SLOTS-1];

Some gcc versions don't support hex float notation and compile such code fine.

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


Re: [Tinycc-devel] -fno-hex-floats option

2016-04-24 Thread Edmund Grimley Evans
> https://github.com/seyko2/tinycc/commit/086ae74b696b7e2a73980bd852516b84251bd553
> 
> don't accept 0x123e-3 float format. This allow to compile
> tccboot kernel with a macro expansion like
> __asm__( "pushl $""0xfe""-256\n\t" );
> 
> gcc don't have problem with this w/o any option. May be gcc don't
> allow a hex floats format in asm file.

GCC doesn't process assembler files; it just passes them to the
assembler, which is part of binutils. However, it may be that GCC puts
the preprocessor into a special mode when preprocessing a .s file.
Please investigate and report back!

In any case, TCC does not need, and should not have, a
"-fno-hex-floats option" option.

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


[Tinycc-devel] -fno-hex-floats option

2016-04-23 Thread Sergey Korshunoff
Hi!
https://github.com/seyko2/tinycc/commit/086ae74b696b7e2a73980bd852516b84251bd553

don't accept 0x123e-3 float format. This allow to compile
tccboot kernel with a macro expansion like
__asm__( "pushl $""0xfe""-256\n\t" );

gcc don't have problem with this w/o any option. May be gcc don't
allow a hex floats format in asm file.

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