diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-03 05:53:58 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-03 05:53:58 +0000 |
commit | 430be8e2b1849cee13a6d721c24132194a371eed (patch) | |
tree | e606116f129427fd27bb72ba8a7b9932d86c2880 /libcpp | |
parent | 3459f6a629a7bf9e64cdd23cbd94349ea420980c (diff) | |
download | gcc-430be8e2b1849cee13a6d721c24132194a371eed.tar.gz |
libcpp/ChangeLog:
* include/cpplib.h (CPP_N_WIDTH_MD, CPP_N_MD_W, CPP_N_MD_Q):
Add new constants.
* expr.c (interpret_float_suffix): Process 'w', 'W', 'q' and 'Q'
suffixes. Return CPP_N_MD_W for 'w' or 'W' suffixes and CPP_N_MD_Q
for 'q' or 'Q' suffixes.
gcc/ChangeLog:
* targhooks.h (default_mode_for_suffix): New function declaration.
* targhooks.c (default_mode_for_suffix): New default target hook.
* target.h (struct c): New structure in the targetm struct.
(mode_for_suffix): New target hook as part of struct c.
target-def.h (TARGET_C_MODE_FOR_SUFFIX): Define as
default_mode_for_suffix.
(TARGET_C): New define.
* c-lex.c: Include "target.h".
(interpret_float): Use targetm.c.mode_for_suffix to determine
the mode for a given non-standard suffix.
Makefile.in (c-lex.o): Depend on $(TARGET_H).
* config/i386/i386.c (ix86_c_mode_for_suffix): New static function.
(TARGET_C_MODE_FOR_SUFFIX): Define to ix86_c_mode_for_suffix.
* doc/extend.texi (Floating Types): New node. Document __float80 and
__float128 types. Document 'w', 'W', 'q' and 'Q' suffixes.
testsuite/ChangeLog:
* gcc.dg/const-float80.c : New test.
* gcc.dg/const-float128.c : New test.
* gcc.dg/const-float80-ped.c : New test.
* gcc.dg/const-float128-ped.c : New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126244 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/expr.c | 20 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 4 |
3 files changed, 29 insertions, 3 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 70a9f608a10..0c11a0fb581 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2007-07-03 Uros Bizjak <ubizjak@gmail.com> + + * include/cpplib.h (CPP_N_WIDTH_MD, CPP_N_MD_W, CPP_N_MD_Q): + Add new constants. + * expr.c (interpret_float_suffix): Process 'w', 'W', 'q' and 'Q' + suffixes. Return CPP_N_MD_W for 'w' or 'W' suffixes and CPP_N_MD_Q + for 'q' or 'Q' suffixes. + 2007-06-17 Danny Smith <dannysmith@users.sourceforge.net * files.c (open_file): Correct typo. diff --git a/libcpp/expr.c b/libcpp/expr.c index 59de8ef9ec9..f20d50c3fdd 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -82,7 +82,9 @@ static void check_promotion (cpp_reader *, const struct op *); static unsigned int interpret_float_suffix (const uchar *s, size_t len) { - size_t f = 0, l = 0, i = 0, d = 0; + size_t f, l, w, q, i, d; + + f = l = w = q = i = d = 0; while (len--) switch (s[len]) @@ -97,6 +99,16 @@ interpret_float_suffix (const uchar *s, size_t len) return 0; l++; break; + case 'w': case 'W': + if (d > 0) + return 0; + w++; + break; + case 'q': case 'Q': + if (d > 0) + return 0; + q++; + break; case 'i': case 'I': case 'j': case 'J': i++; break; case 'd': case 'D': d++; break; @@ -104,7 +116,7 @@ interpret_float_suffix (const uchar *s, size_t len) return 0; } - if (f + l > 1 || i > 1) + if (f + l + w + q > 1 || i > 1) return 0; /* Allow dd, df, dl suffixes for decimal float constants. */ @@ -113,7 +125,9 @@ interpret_float_suffix (const uchar *s, size_t len) return ((i ? CPP_N_IMAGINARY : 0) | (f ? CPP_N_SMALL : - l ? CPP_N_LARGE : CPP_N_MEDIUM) + l ? CPP_N_LARGE : + w ? CPP_N_MD_W : + q ? CPP_N_MD_Q : CPP_N_MEDIUM) | (d ? CPP_N_DFLOAT : 0)); } diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 0edcf655c92..ee46c4f169f 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -744,6 +744,10 @@ struct cpp_num #define CPP_N_MEDIUM 0x0020 /* long, double. */ #define CPP_N_LARGE 0x0040 /* long long, long double. */ +#define CPP_N_WIDTH_MD 0xF0000 /* machine defined. */ +#define CPP_N_MD_W 0x10000 +#define CPP_N_MD_Q 0x20000 + #define CPP_N_RADIX 0x0F00 #define CPP_N_DECIMAL 0x0100 #define CPP_N_HEX 0x0200 |