Skip to content

Commit e2204fc

Browse files
authored
Merge pull request #1032 from tautschnig/empty-cleanup
Use empty() instead of size()==0, size()<1
2 parents a71dfb5 + 9d991b4 commit e2204fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+61
-64
lines changed

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,7 @@ exprt c_typecheck_baset::do_special_functions(
25662566
// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
25672567

25682568
// adjust return type of function to match pointer subtype
2569-
if(expr.arguments().size()<1)
2569+
if(expr.arguments().empty())
25702570
{
25712571
err_location(f_op);
25722572
error() << "__sync_* primitives take as least one argument" << eom;

src/ansi-c/expr2c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ std::string expr2ct::convert_code_switch(
25882588
const codet &src,
25892589
unsigned indent)
25902590
{
2591-
if(src.operands().size()<1)
2591+
if(src.operands().empty())
25922592
{
25932593
unsigned precedence;
25942594
return convert_norep(src, precedence);

src/clobber/clobber_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ bool clobber_parse_optionst::get_goto_program(
192192
const optionst &options,
193193
goto_functionst &goto_functions)
194194
{
195-
if(cmdline.args.size()==0)
195+
if(cmdline.args.empty())
196196
{
197197
error() << "Please provide a program to verify" << eom;
198198
return true;

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void cpp_typecheckt::typecheck_compound_declarator(
466466
{
467467
is_virtual=true;
468468
const code_typet &code_type=to_code_type(comp.type());
469-
assert(code_type.parameters().size()>0);
469+
assert(!code_type.parameters().empty());
470470
const typet &pointer_type=code_type.parameters()[0].type();
471471
assert(pointer_type.id()==ID_pointer);
472472
virtual_bases.insert(pointer_type.subtype().get(ID_identifier));

src/cpp/cpp_typecheck_conversions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,13 +574,13 @@ bool cpp_typecheckt::standard_conversion_pointer_to_member(
574574
expr.type().subtype().id()==ID_code)
575575
{
576576
code_typet code1=to_code_type(expr.type().subtype());
577-
assert(code1.parameters().size()>0);
577+
assert(!code1.parameters().empty());
578578
code_typet::parametert this1=code1.parameters()[0];
579579
assert(this1.get(ID_C_base_name)==ID_this);
580580
code1.parameters().erase(code1.parameters().begin());
581581

582582
code_typet code2=to_code_type(type.subtype());
583-
assert(code2.parameters().size()>0);
583+
assert(!code2.parameters().empty());
584584
code_typet::parametert this2=code2.parameters()[0];
585585
assert(this2.get(ID_C_base_name)==ID_this);
586586
code2.parameters().erase(code2.parameters().begin());

src/cpp/cpp_typecheck_expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ void cpp_typecheckt::typecheck_expr_cpp_name(
14311431
// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
14321432

14331433
// adjust return type of function to match pointer subtype
1434-
if(fargs.operands.size()<1)
1434+
if(fargs.operands.empty())
14351435
{
14361436
error().source_location=source_location;
14371437
error() << "__sync_* primitives take as least one argument"

src/goto-cc/compile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ bool compilet::doit()
102102
return true;
103103
}
104104

105-
if(mode==LINK_LIBRARY && source_files.size()>0)
105+
if(mode==LINK_LIBRARY && !source_files.empty())
106106
{
107107
error() << "cannot link source files" << eom;
108108
return true;
109109
}
110110

111-
if(mode==PREPROCESS_ONLY && object_files.size()>0)
111+
if(mode==PREPROCESS_ONLY && !object_files.empty())
112112
{
113113
error() << "cannot preprocess object files" << eom;
114114
return true;
@@ -117,7 +117,7 @@ bool compilet::doit()
117117
const unsigned warnings_before=
118118
get_message_handler().get_message_count(messaget::M_WARNING);
119119

120-
if(source_files.size()>0)
120+
if(!source_files.empty())
121121
if(compile())
122122
return true;
123123

@@ -346,7 +346,7 @@ bool compilet::link()
346346
convert_symbols(compiled_functions);
347347

348348
// parse object files
349-
while(object_files.size()>0)
349+
while(!object_files.empty())
350350
{
351351
std::string file_name=object_files.front();
352352
object_files.pop_front();

src/goto-cc/xml_binaries/xml_goto_function.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ void convert(const xmlt &xml, goto_functionst::goto_functiont &function)
3333
{
3434
function.body.clear();
3535
convert(xml, function.body);
36-
function.body_available = function.body.instructions.size()>0;
3736
// don't forget to fix the functions type via the symbol table!
3837
}

src/goto-cc/xml_binaries/xml_goto_function_hashing.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ void xml_goto_function_convertt::convert(
3838
xml_goto_program_convertt gpconverter(ireps_container);
3939
function.body.clear();
4040
gpconverter.convert(xml, function.body);
41-
function.body_available = function.body.instructions.size()>0;
4241
// don't forget to fix the functions type via the symbol table!
4342
}

src/goto-cc/xml_binaries/xml_symbol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void convert(const symbolt &sym, xmlt &root)
5454
flags.new_element("base_name").data=id2string(sym.base_name);
5555
flags.new_element("module").data=id2string(sym.module);
5656

57-
if(sym.pretty_name.size()>0)
57+
if(!sym.pretty_name.empty())
5858
flags.new_element("pretty_name").data=id2string(sym.pretty_name);
5959

6060
xmlt &xmlloc = xmlsym.new_element("location");

0 commit comments

Comments
 (0)