Skip to content

Commit 93ae9f3

Browse files
Merge pull request diffblue#1527 from diffblue/revert-1510-always-inline
Revert "Fully process always_inline"
2 parents 22a876f + 535f1df commit 93ae9f3

File tree

13 files changed

+2
-159
lines changed

13 files changed

+2
-159
lines changed

regression/ansi-c/always_inline1/main.c

Lines changed: 0 additions & 32 deletions
This file was deleted.

regression/ansi-c/always_inline1/test.desc

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/ansi-c/ansi_c_convert_type.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ void ansi_c_convert_typet::read_rec(const typet &type)
155155
c_storage_spec.is_register=true;
156156
else if(type.id()==ID_weak)
157157
c_storage_spec.is_weak=true;
158-
else if(type.id()==ID_always_inline)
159-
c_storage_spec.is_always_inline=true;
160158
else if(type.id()==ID_auto)
161159
{
162160
// ignore

src/ansi-c/ansi_c_declaration.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ void ansi_c_declarationt::output(std::ostream &out) const
8181
out << " is_extern";
8282
if(get_is_static_assert())
8383
out << " is_static_assert";
84-
if(get_is_always_inline())
85-
out << " is_always_inline";
8684
out << "\n";
8785

8886
out << "Type: " << type().pretty() << "\n";
@@ -166,9 +164,6 @@ void ansi_c_declarationt::to_symbol(
166164
symbol.is_extern=false;
167165
else if(get_is_extern()) // traditional GCC
168166
symbol.is_file_local=true;
169-
170-
if(get_is_always_inline())
171-
symbol.is_macro=true;
172167
}
173168
}
174169
}

src/ansi-c/ansi_c_declaration.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,6 @@ class ansi_c_declarationt:public exprt
195195
set(ID_is_weak, is_weak);
196196
}
197197

198-
bool get_is_always_inline() const
199-
{
200-
return get_bool(ID_is_always_inline);
201-
}
202-
203-
void set_is_always_inline(bool is_always_inline)
204-
{
205-
set(ID_is_always_inline, is_always_inline);
206-
}
207-
208198
void to_symbol(
209199
const ansi_c_declaratort &,
210200
symbolt &symbol) const;

src/ansi-c/c_storage_spec.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ void c_storage_spect::read(const typet &type)
3232
is_register=true;
3333
else if(type.id()==ID_weak)
3434
is_weak=true;
35-
else if(type.id()==ID_always_inline)
36-
is_always_inline=true;
3735
else if(type.id()==ID_auto)
3836
{
3937
// ignore

src/ansi-c/c_storage_spec.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ class c_storage_spect
3535
is_register=false;
3636
is_inline=false;
3737
is_weak=false;
38-
is_always_inline=false;
3938
alias.clear();
4039
asm_label.clear();
4140
section.clear();
4241
}
4342

4443
bool is_typedef, is_extern, is_static, is_register,
45-
is_inline, is_thread_local, is_weak, is_always_inline;
44+
is_inline, is_thread_local, is_weak;
4645

4746
// __attribute__((alias("foo")))
4847
irep_idt alias;
@@ -60,7 +59,6 @@ class c_storage_spect
6059
is_thread_local==other.is_thread_local &&
6160
is_inline==other.is_inline &&
6261
is_weak==other.is_weak &&
63-
is_always_inline==other.is_always_inline &&
6462
alias==other.alias &&
6563
asm_label==other.asm_label &&
6664
section==other.section;
@@ -80,7 +78,6 @@ class c_storage_spect
8078
is_inline |=other.is_inline;
8179
is_thread_local |=other.is_thread_local;
8280
is_weak |=other.is_weak;
83-
is_always_inline|=other.is_always_inline;
8481
if(alias.empty())
8582
alias=other.alias;
8683
if(asm_label.empty())

src/ansi-c/c_typecheck_base.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ void c_typecheck_baset::typecheck_declaration(
688688
declaration.set_is_register(full_spec.is_register);
689689
declaration.set_is_typedef(full_spec.is_typedef);
690690
declaration.set_is_weak(full_spec.is_weak);
691-
declaration.set_is_always_inline(full_spec.is_always_inline);
692691

693692
symbolt symbol;
694693
declaration.to_symbol(*d_it, symbol);

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Author: Daniel Kroening, [email protected]
2424
#include <util/std_expr.h>
2525
#include <util/pointer_offset_size.h>
2626
#include <util/pointer_predicates.h>
27-
#include <util/replace_symbol.h>
2827

2928
#include "c_typecast.h"
3029
#include "c_qualifiers.h"
@@ -1914,10 +1913,7 @@ void c_typecheck_baset::typecheck_side_effect_function_call(
19141913
if(entry!=asm_label_map.end())
19151914
identifier=entry->second;
19161915

1917-
symbol_tablet::symbolst::const_iterator sym_entry=
1918-
symbol_table.symbols.find(identifier);
1919-
1920-
if(sym_entry==symbol_table.symbols.end())
1916+
if(symbol_table.symbols.find(identifier)==symbol_table.symbols.end())
19211917
{
19221918
// This is an undeclared function. Let's just add it.
19231919
// We do a bit of return-type guessing, but just a bit.
@@ -1949,72 +1945,6 @@ void c_typecheck_baset::typecheck_side_effect_function_call(
19491945
warning().source_location=f_op.find_source_location();
19501946
warning() << "function `" << identifier << "' is not declared" << eom;
19511947
}
1952-
else if(sym_entry->second.type.get_bool(ID_C_inlined) &&
1953-
sym_entry->second.is_macro &&
1954-
sym_entry->second.value.is_not_nil())
1955-
{
1956-
// calling a function marked as always_inline
1957-
const symbolt &func_sym=sym_entry->second;
1958-
const code_typet &func_type=to_code_type(func_sym.type);
1959-
1960-
replace_symbolt replace;
1961-
1962-
const code_typet::parameterst &parameters=func_type.parameters();
1963-
auto p_it=parameters.begin();
1964-
for(const auto &arg : expr.arguments())
1965-
{
1966-
if(p_it==parameters.end())
1967-
{
1968-
err_location(f_op);
1969-
error() << "function call has additional arguments, "
1970-
<< "cannot apply always_inline" << eom;
1971-
throw 0;
1972-
}
1973-
1974-
irep_idt p_id=p_it->get_identifier();
1975-
if(p_id.empty())
1976-
p_id=
1977-
id2string(func_sym.base_name)+"::"+
1978-
id2string(p_it->get_base_name());
1979-
replace.insert(p_id, arg);
1980-
1981-
++p_it;
1982-
}
1983-
1984-
if(p_it!=parameters.end())
1985-
{
1986-
err_location(f_op);
1987-
error() << "function call has missing arguments, "
1988-
<< "cannot apply always_inline" << eom;
1989-
throw 0;
1990-
}
1991-
1992-
codet body=to_code(func_sym.value);
1993-
replace(body);
1994-
1995-
side_effect_exprt side_effect_expr(
1996-
ID_statement_expression, func_type.return_type());
1997-
body.make_block();
1998-
1999-
// simulates parts of typecheck_function_body
2000-
typet cur_return_type=return_type;
2001-
return_type=func_type.return_type();
2002-
typecheck_code(body);
2003-
return_type.swap(cur_return_type);
2004-
2005-
// replace final return by an ID_expression
2006-
codet &last=to_code_block(body).find_last_statement();
2007-
2008-
if(last.get_statement()==ID_return)
2009-
last.set_statement(ID_expression);
2010-
2011-
side_effect_expr.copy_to_operands(body);
2012-
typecheck_side_effect_statement_expression(side_effect_expr);
2013-
2014-
expr.swap(side_effect_expr);
2015-
2016-
return;
2017-
}
20181948
}
20191949

20201950
// typecheck it now

src/ansi-c/parser.y

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ extern char *yyansi_ctext;
142142
%token TOK_GCC_ATTRIBUTE_NORETURN "noreturn"
143143
%token TOK_GCC_ATTRIBUTE_CONSTRUCTOR "constructor"
144144
%token TOK_GCC_ATTRIBUTE_DESTRUCTOR "destructor"
145-
%token TOK_GCC_ATTRIBUTE_ALWAYS_INLINE "always_inline"
146145
%token TOK_GCC_LABEL "__label__"
147146
%token TOK_MSC_ASM "__asm"
148147
%token TOK_MSC_BASED "__based"
@@ -1532,8 +1531,6 @@ gcc_type_attribute:
15321531
{ $$=$1; set($$, ID_constructor); }
15331532
| TOK_GCC_ATTRIBUTE_DESTRUCTOR
15341533
{ $$=$1; set($$, ID_destructor); }
1535-
| TOK_GCC_ATTRIBUTE_ALWAYS_INLINE
1536-
{ $$=$1; set($$, ID_always_inline); }
15371534
;
15381535

15391536
gcc_attribute:

src/ansi-c/scanner.l

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,9 +1537,6 @@ __decltype { if(PARSER.cpp98 &&
15371537
"destructor" |
15381538
"__destructor__" { BEGIN(GCC_ATTRIBUTE3); loc(); return TOK_GCC_ATTRIBUTE_DESTRUCTOR; }
15391539

1540-
"always_inline" |
1541-
"__always_inline__" { BEGIN(GCC_ATTRIBUTE3); loc(); return TOK_GCC_ATTRIBUTE_ALWAYS_INLINE; }
1542-
15431540
{ws} { /* ignore */ }
15441541
{newline} { /* ignore */ }
15451542
{identifier} { BEGIN(GCC_ATTRIBUTE4); }

src/util/irep_ids.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,6 @@ IREP_ID_TWO(C_java_generics_class_type, #java_generics_class_type)
830830
IREP_ID_TWO(generic_types, #generic_types)
831831
IREP_ID_TWO(type_variables, #type_variables)
832832
IREP_ID_ONE(havoc_object)
833-
IREP_ID_ONE(always_inline)
834-
IREP_ID_ONE(is_always_inline)
835833

836834
#undef IREP_ID_ONE
837835
#undef IREP_ID_TWO

src/util/replace_symbol.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,6 @@ bool replace_symbolt::replace(
104104
result=false;
105105
}
106106

107-
const irept &type_arg=dest.find(ID_type_arg);
108-
109-
if(type_arg.is_not_nil())
110-
{
111-
typet &type=static_cast<typet &>(dest.add(ID_type_arg));
112-
113-
if(!replace(type))
114-
result=false;
115-
}
116-
117107
const irept &va_arg_type=dest.find(ID_C_va_arg_type);
118108

119109
if(va_arg_type.is_not_nil())
@@ -149,12 +139,6 @@ bool replace_symbolt::have_to_replace(const exprt &dest) const
149139
if(have_to_replace(static_cast<const typet &>(c_sizeof_type)))
150140
return true;
151141

152-
const irept &type_arg=dest.find(ID_type_arg);
153-
154-
if(type_arg.is_not_nil())
155-
if(have_to_replace(static_cast<const typet &>(type_arg)))
156-
return true;
157-
158142
const irept &va_arg_type=dest.find(ID_C_va_arg_type);
159143

160144
if(va_arg_type.is_not_nil())

0 commit comments

Comments
 (0)