A test recently added to gdb.opt/inline-cmds.exp fails for
arm-none-eabi targets because -O2 leads to instructions to be
reordered widely.
I guess it might have made sense years ago to enable optimization in
these tests, but I fail to see the need for that nowadays.
Using -O0 while relying on __attribute__((always_inline)), which is
already used in the tests [1] [2], avoids this sort of trouble, while
still exercising the inlining-related use cases that are the focus of
these tests.
I think that nowadays we can safely assume that all compilers we care
about support __attribute__((always_inline)) or similar.
[1] - Except one spot that missed it.
[2] - Note that the .exp files make sure the frames that should have
been inlined are indeed inlined, with "info frame".
gdb/testsuite/ChangeLog:
2016-07-19 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.exp: Remove optimize=-O2.
* gdb.opt/inline-bt.exp: Likewise.
* gdb.opt/inline-cmds.exp: Remove optimize=-O2 and add
additional_flags=-Winline.
* gdb.opt/inline-locals.exp: Likewise.
* gdb.opt/inline-markers.c (ATTR): Define.
(inlined_fn): Use it.
+2016-07-19 Pedro Alves <palves@redhat.com>
+
+ * gdb.opt/inline-break.exp: Remove optimize=-O2.
+ * gdb.opt/inline-bt.exp: Likewise.
+ * gdb.opt/inline-cmds.exp: Remove optimize=-O2 and add
+ additional_flags=-Winline.
+ * gdb.opt/inline-locals.exp: Likewise.
+ * gdb.opt/inline-markers.c (ATTR): Define.
+ (inlined_fn): Use it.
+
2016-07-19 Yao Qi <yao.qi@linaro.org>
* gdb.gdb/selftest.exp: Remove checks on is_remote and isnative.
2016-07-19 Yao Qi <yao.qi@linaro.org>
* gdb.gdb/selftest.exp: Remove checks on is_remote and isnative.
standard_testfile
if { [prepare_for_testing $testfile.exp $testfile $srcfile \
standard_testfile
if { [prepare_for_testing $testfile.exp $testfile $srcfile \
- {debug optimize=-O2 additional_flags=-Winline}] } {
+ {debug additional_flags=-Winline}] } {
if {[prepare_for_testing $testfile.exp $testfile \
[list $srcfile $srcfile2] \
if {[prepare_for_testing $testfile.exp $testfile \
[list $srcfile $srcfile2] \
- {debug optimize=-O2 additional_flags=-Winline}]} {
+ {debug additional_flags=-Winline}]} {
standard_testfile .c inline-markers.c
if {[prepare_for_testing $testfile.exp $testfile \
standard_testfile .c inline-markers.c
if {[prepare_for_testing $testfile.exp $testfile \
- [list $srcfile $srcfile2] {debug optimize=-O2}]} {
+ [list $srcfile $srcfile2] {debug additional_flags=-Winline}]} {
standard_testfile .c inline-markers.c
if {[prepare_for_testing $testfile.exp $testfile \
standard_testfile .c inline-markers.c
if {[prepare_for_testing $testfile.exp $testfile \
- [list $srcfile $srcfile2] {debug optimize=-O2}]} {
+ [list $srcfile $srcfile2] {debug additional_flags=-Winline}]} {
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifdef __GNUC__
+# define ATTR __attribute__((always_inline))
+#else
+# define ATTR
+#endif
+
extern int x, y;
extern volatile int z;
extern int x, y;
extern volatile int z;
x += y - z; /* set breakpoint 2 here */
}
x += y - z; /* set breakpoint 2 here */
}
-inline void inlined_fn(void)
+inline ATTR void inlined_fn(void)