diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0216-2011-05-04-Steven-G.-Kargl-kargl-gcc.gnu.org.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0216-2011-05-04-Steven-G.-Kargl-kargl-gcc.gnu.org.patch | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0216-2011-05-04-Steven-G.-Kargl-kargl-gcc.gnu.org.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0216-2011-05-04-Steven-G.-Kargl-kargl-gcc.gnu.org.patch new file mode 100644 index 0000000000..2cae794bb7 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0216-2011-05-04-Steven-G.-Kargl-kargl-gcc.gnu.org.patch | |||
@@ -0,0 +1,189 @@ | |||
1 | From 4eae6ccb843f9ac74bd928fab5247ae8e79e0d0f Mon Sep 17 00:00:00 2001 | ||
2 | From: kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Wed, 4 May 2011 19:18:01 +0000 | ||
4 | Subject: [PATCH] 2011-05-04 Steven G. Kargl <kargl@gcc.gnu.org> | ||
5 | |||
6 | PR fortran/48720 | ||
7 | * gfortran.texi: Document the 'Q' exponent-letter extension. | ||
8 | * invoke.texi: Document -Wreal-q-constant. | ||
9 | * lang.opt: Add -Wreal-q-constant option. | ||
10 | * gfortran.h: Add warn_real_q_constant to option struct. | ||
11 | * primary.c (match_real_constant): Use it. Accept 'Q' as | ||
12 | exponent-letter for REAL(16) real-literal-constant with a | ||
13 | fallback to REAL(10) or error if REAL(10) is not available. | ||
14 | * options.c (gfc_init_options, set_Wall) Set it. | ||
15 | (gfc_handle_option): Handle new option. | ||
16 | |||
17 | |||
18 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173392 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
19 | |||
20 | index b64fa20..165bd2f 100644 | ||
21 | --- a/gcc/fortran/gfortran.h | ||
22 | +++ b/gcc/fortran/gfortran.h | ||
23 | @@ -2190,6 +2190,7 @@ typedef struct | ||
24 | int warn_character_truncation; | ||
25 | int warn_array_temp; | ||
26 | int warn_align_commons; | ||
27 | + int warn_real_q_constant; | ||
28 | int warn_unused_dummy_argument; | ||
29 | int max_errors; | ||
30 | |||
31 | diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi | ||
32 | index 2f63bbb..88676cd 100644 | ||
33 | --- a/gcc/fortran/gfortran.texi | ||
34 | +++ b/gcc/fortran/gfortran.texi | ||
35 | @@ -1237,6 +1237,7 @@ without warning. | ||
36 | * Missing period in FORMAT specifications:: | ||
37 | * I/O item lists:: | ||
38 | * BOZ literal constants:: | ||
39 | +* @code{Q} exponent-letter:: | ||
40 | * Real array indices:: | ||
41 | * Unary operators:: | ||
42 | * Implicitly convert LOGICAL and INTEGER values:: | ||
43 | @@ -1427,6 +1428,18 @@ To support legacy codes, GNU Fortran allows the input item list | ||
44 | of the @code{READ} statement, and the output item lists of the | ||
45 | @code{WRITE} and @code{PRINT} statements, to start with a comma. | ||
46 | |||
47 | +@node @code{Q} exponent-letter | ||
48 | +@subsection @code{Q} exponent-letter | ||
49 | +@cindex @code{Q} exponent-letter | ||
50 | + | ||
51 | +GNU Fortran accepts real literal constants with an exponent-letter | ||
52 | +of @code{Q}, for example, @code{1.23Q45}. The constant is interpreted | ||
53 | +as a @code{REAL(16)} entity on targets that suppports this type. If | ||
54 | +the target does not support @code{REAL(16)} but has a @code{REAL(10)} | ||
55 | +type, then the real-literal-constant will be interpreted as a | ||
56 | +@code{REAL(10)} entity. In the absence of @code{REAL(16)} and | ||
57 | +@code{REAL(10)}, an error will occur. | ||
58 | + | ||
59 | @node BOZ literal constants | ||
60 | @subsection BOZ literal constants | ||
61 | @cindex BOZ literal constants | ||
62 | diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi | ||
63 | index 22245c9..9a286c0 100644 | ||
64 | --- a/gcc/fortran/invoke.texi | ||
65 | +++ b/gcc/fortran/invoke.texi | ||
66 | @@ -692,7 +692,7 @@ we recommend avoiding and that we believe are easy to avoid. | ||
67 | This currently includes @option{-Waliasing}, @option{-Wampersand}, | ||
68 | @option{-Wconversion}, @option{-Wsurprising}, @option{-Wintrinsics-std}, | ||
69 | @option{-Wno-tabs}, @option{-Wintrinsic-shadow}, @option{-Wline-truncation}, | ||
70 | -and @option{-Wunused}. | ||
71 | +@option{-Wreal-q-constant} and @option{-Wunused}. | ||
72 | |||
73 | @item -Waliasing | ||
74 | @opindex @code{Waliasing} | ||
75 | @@ -780,6 +780,12 @@ it as @code{EXTERNAL} procedure because of this. @option{-fall-intrinsics} can | ||
76 | be used to never trigger this behavior and always link to the intrinsic | ||
77 | regardless of the selected standard. | ||
78 | |||
79 | +@item -Wreal-q-constant | ||
80 | +@opindex @code{Wreal-q-constant} | ||
81 | +@cindex warnings, @code{q} exponent-letter | ||
82 | +Produce a warning if a real-literal-constant contains a @code{q} | ||
83 | +exponent-letter. | ||
84 | + | ||
85 | @item -Wsurprising | ||
86 | @opindex @code{Wsurprising} | ||
87 | @cindex warnings, suspicious code | ||
88 | diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt | ||
89 | index 69b3144..02fbaeb 100644 | ||
90 | --- a/gcc/fortran/lang.opt | ||
91 | +++ b/gcc/fortran/lang.opt | ||
92 | @@ -238,6 +238,10 @@ Wintrinsics-std | ||
93 | Fortran Warning | ||
94 | Warn on intrinsics not part of the selected standard | ||
95 | |||
96 | +Wreal-q-constant | ||
97 | +Fortran Warning | ||
98 | +Warn about real-literal-constants with 'q' exponent-letter | ||
99 | + | ||
100 | Wreturn-type | ||
101 | Fortran Warning | ||
102 | ; Documented in C | ||
103 | diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c | ||
104 | index c116103..7073388 100644 | ||
105 | --- a/gcc/fortran/options.c | ||
106 | +++ b/gcc/fortran/options.c | ||
107 | @@ -107,6 +107,7 @@ gfc_init_options (unsigned int decoded_options_count, | ||
108 | gfc_option.warn_intrinsic_shadow = 0; | ||
109 | gfc_option.warn_intrinsics_std = 0; | ||
110 | gfc_option.warn_align_commons = 1; | ||
111 | + gfc_option.warn_real_q_constant = 0; | ||
112 | gfc_option.warn_unused_dummy_argument = 0; | ||
113 | gfc_option.max_errors = 25; | ||
114 | |||
115 | @@ -445,6 +446,7 @@ set_Wall (int setting) | ||
116 | gfc_option.warn_intrinsic_shadow = setting; | ||
117 | gfc_option.warn_intrinsics_std = setting; | ||
118 | gfc_option.warn_character_truncation = setting; | ||
119 | + gfc_option.warn_real_q_constant = setting; | ||
120 | gfc_option.warn_unused_dummy_argument = setting; | ||
121 | |||
122 | warn_unused = setting; | ||
123 | @@ -643,6 +645,10 @@ gfc_handle_option (size_t scode, const char *arg, int value, | ||
124 | gfc_option.warn_align_commons = value; | ||
125 | break; | ||
126 | |||
127 | + case OPT_Wreal_q_constant: | ||
128 | + gfc_option.warn_real_q_constant = value; | ||
129 | + break; | ||
130 | + | ||
131 | case OPT_Wunused_dummy_argument: | ||
132 | gfc_option.warn_unused_dummy_argument = value; | ||
133 | break; | ||
134 | diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c | ||
135 | index 4cda7a1..22cfbc2 100644 | ||
136 | --- a/gcc/fortran/primary.c | ||
137 | +++ b/gcc/fortran/primary.c | ||
138 | @@ -541,6 +541,17 @@ match_real_constant (gfc_expr **result, int signflag) | ||
139 | goto done; | ||
140 | exp_char = c; | ||
141 | |||
142 | + | ||
143 | + if (c == 'q') | ||
144 | + { | ||
145 | + if (gfc_notify_std (GFC_STD_GNU, "Extension: exponent-letter 'q' in " | ||
146 | + "real-literal-constant at %C") == FAILURE) | ||
147 | + return MATCH_ERROR; | ||
148 | + else if (gfc_option.warn_real_q_constant) | ||
149 | + gfc_warning("Extension: exponent-letter 'q' in real-literal-constant " | ||
150 | + "at %C"); | ||
151 | + } | ||
152 | + | ||
153 | /* Scan exponent. */ | ||
154 | c = gfc_next_ascii_char (); | ||
155 | count++; | ||
156 | @@ -616,6 +627,30 @@ done: | ||
157 | kind = gfc_default_double_kind; | ||
158 | break; | ||
159 | |||
160 | + case 'q': | ||
161 | + if (kind != -2) | ||
162 | + { | ||
163 | + gfc_error ("Real number at %C has a 'q' exponent and an explicit " | ||
164 | + "kind"); | ||
165 | + goto cleanup; | ||
166 | + } | ||
167 | + | ||
168 | + /* The maximum possible real kind type parameter is 16. First, try | ||
169 | + that for the kind, then fallback to trying kind=10 (Intel 80 bit) | ||
170 | + extended precision. If neither value works, just given up. */ | ||
171 | + kind = 16; | ||
172 | + if (gfc_validate_kind (BT_REAL, kind, true) < 0) | ||
173 | + { | ||
174 | + kind = 10; | ||
175 | + if (gfc_validate_kind (BT_REAL, kind, true) < 0) | ||
176 | + { | ||
177 | + gfc_error ("Invalid exponent-letter 'q' in " | ||
178 | + "real-literal-constant at %C"); | ||
179 | + goto cleanup; | ||
180 | + } | ||
181 | + } | ||
182 | + break; | ||
183 | + | ||
184 | default: | ||
185 | if (kind == -2) | ||
186 | kind = gfc_default_real_kind; | ||
187 | -- | ||
188 | 1.7.0.4 | ||
189 | |||