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 /gcc/c-lex.c | |
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 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index a89643c6046..ff8eee6baec 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -41,6 +41,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "tm_p.h" #include "splay-tree.h" #include "debug.h" +#include "target.h" /* We may keep statistics about how long which files took to compile. */ static int header_time, body_time; @@ -649,7 +650,31 @@ interpret_float (const cpp_token *token, unsigned int flags) else type = dfloat64_type_node; else - if ((flags & CPP_N_WIDTH) == CPP_N_LARGE) + if (flags & CPP_N_WIDTH_MD) + { + char suffix; + enum machine_mode mode; + + if ((flags & CPP_N_WIDTH_MD) == CPP_N_MD_W) + suffix = 'w'; + else + suffix = 'q'; + + mode = targetm.c.mode_for_suffix (suffix); + if (mode == VOIDmode) + { + error ("unsupported non-standard suffix on floating constant"); + errorcount++; + + return error_mark_node; + } + else if (pedantic) + pedwarn ("non-standard suffix on floating constant"); + + type = c_common_type_for_mode (mode, 0); + gcc_assert (type); + } + else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE) type = long_double_type_node; else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL || flag_single_precision_constant) @@ -666,7 +691,7 @@ interpret_float (const cpp_token *token, unsigned int flags) else { if ((flags & CPP_N_WIDTH) != CPP_N_MEDIUM) - /* Must be an F or L suffix. */ + /* Must be an F or L or machine defined suffix. */ copylen--; if (flags & CPP_N_IMAGINARY) /* I or J suffix. */ |