Skip to content

remove a warning about section names #2242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/ansi-c/c_typecheck_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,23 +723,25 @@ void c_typecheck_baset::typecheck_declaration(
{
// section name is not empty, do a bit of parsing
std::string asm_name = id2string(full_spec.section);
if(asm_name[0] != '.')

if(asm_name[0] == '.')
{
warning().source_location = symbol.location;
warning() << "section name `" << asm_name
<< "' expected to start with `.'" << eom;
std::string::size_type primary_section = asm_name.find('.', 1);

if(primary_section != std::string::npos)
asm_name.resize(primary_section);
}
std::string::size_type primary_section = asm_name.find('.', 1);
if(primary_section != std::string::npos)
asm_name.resize(primary_section);

asm_name += "$$";

if(!full_spec.asm_label.empty())
asm_name+=id2string(full_spec.asm_label);
else
asm_name+=id2string(symbol.name);

apply_asm_label(asm_name, symbol);
}

irep_idt identifier=symbol.name;
d_it->set_name(identifier);

Expand Down