gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gold / testsuite / odr_violation2.cc
CommitLineData
a55ce7fe 1#include <algorithm>
71ff8986 2#include "odr_header1.h"
a55ce7fe
ILT
3
4class Ordering {
5 public:
71ff8986
ILT
6 bool operator()(int a, int b) __attribute__((never_inline));
7};
8
ed16fd1b
ILT
9// This comment makes the line numbers in Ordering::operator() all have
10// two digits, which causes gold's output to be independent of which
11// instruction the compiler optimizes into the front of the function.
71ff8986
ILT
12bool Ordering::operator()(int a, int b) {
13 // Optimization makes this operator() a different size than the one
14 // in odr_violation1.cc.
e10cfd06 15 return (a * 30 + b + 12345) > b / 67;
ed16fd1b 16}
a55ce7fe
ILT
17
18void SortDescending(int array[], int size) {
19 std::sort(array, array + size, Ordering());
20}
9691462b
ILT
21
22// This is weak in odr_violation1.cc.
23extern "C" int OverriddenCFunction(int i) {
24 return i * i;
25}
0af4ccfc
CC
26
27// Extra lines to put SometimeInlineFunction at line 30+.
28
29// And a dummy function to workaround a GCC 7 bug with debug line numbers.
30int DummyFunction(int i) {
31 return i ^ 0x5555;
32}
33
9691462b
ILT
34// This is inline in debug_msg.cc, which makes it a weak symbol too.
35int SometimesInlineFunction(int i) {
36 return i * i;
37}
71ff8986
ILT
38
39// Instantiate the Derived vtable, with optimization (see Makefile.am).
40OdrBase* CreateOdrDerived2() {
41 return new OdrDerived;
42}
This page took 0.53711 seconds and 4 git commands to generate.