[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [Makefile] asm: handle comments when creating header file



>>> On 22.01.18 at 22:19, <tautschn@xxxxxxxxxxxx> wrote:
> Jan, All,
> 
>> On 10 Jan 2018, at 16:02, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>> 
>>>>> On 10.01.18 at 16:14, <nmanthey@xxxxxxxxxx> wrote:
>>> In the early steps of compilation, the asm header files are created, such
>>> as include/asm-$(TARGET_ARCH)/asm-offsets.h. These files depend on the
>>> assembly file arch/$(TARGET_ARCH)/asm-offsets.s, which is generated
>>> before. Depending on the used assembler, there might be comments in the
>>> assembly files.
>>> 
>>> This commit adds handling comments in the assembler during the creation of
>>> the asm header files.
>> 
>> I have a hard time seeing how ...
>> 
>>> --- a/xen/Makefile
>>> +++ b/xen/Makefile
>>> @@ -189,7 +189,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: 
>>> arch/$(TARGET_ARCH)/asm-offsets.s
>>>       echo "#ifndef __ASM_OFFSETS_H__"; \
>>>       echo "#define __ASM_OFFSETS_H__"; \
>>>       echo ""; \
>>> -     sed -rne "/==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
>> 
>> ... this pattern could match any comment that we currently have.
>> Would you mind clarifying what it is that is actually broken (and
>> hence wants/needs fixing)?
>> 
> 
> Re-adding the new line:
> 
> +       sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
> 
> The change "handles comments" by not printing those to the generated header
> file, where they would confuse the preprocessor (as "#" starts comments at
> the assembler level). It seems perfectly ok if this matches any existing
> comments as none such should get printed to the header file.
> 
> The problems showed up when using goto-gcc (a compiler for subsequent use of
> static analysis tooling), which embeds additional information in the 
> comments.

Please add some clarification along those lines to the description.
I then also assume that you mean "used compiler" instead of "used
assembler" in the description? Additionally, if you want to strip
comments, please strip all of them, i.e. including such starting
with # after some leading white space.

Furthermore, the character (or sequence of characters) starting
a comment is target specific - this wants specifying by the per-arch
Rules.mk, I think, so that it'll also work on ARM (where # has a
different meaning). Along those lines, x86 allows // to start a
(full line) comment as well.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.