Skip to content

Commit ac8e60e

Browse files
committed
Section names often start with '.', but not always
The Linux kernel violates this rule in several places.
1 parent 5b176bf commit ac8e60e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/ansi-c/c_typecheck_base.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -723,15 +723,12 @@ void c_typecheck_baset::typecheck_declaration(
723723
{
724724
// section name is not empty, do a bit of parsing
725725
std::string asm_name = id2string(full_spec.section);
726-
if(asm_name[0] != '.')
726+
if(asm_name[0] == '.')
727727
{
728-
warning().source_location = symbol.location;
729-
warning() << "section name `" << asm_name
730-
<< "' expected to start with `.'" << eom;
728+
std::string::size_type primary_section = asm_name.find('.', 1);
729+
if(primary_section != std::string::npos)
730+
asm_name.resize(primary_section);
731731
}
732-
std::string::size_type primary_section = asm_name.find('.', 1);
733-
if(primary_section != std::string::npos)
734-
asm_name.resize(primary_section);
735732
asm_name += "$$";
736733
if(!full_spec.asm_label.empty())
737734
asm_name+=id2string(full_spec.asm_label);

0 commit comments

Comments
 (0)