This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using the asm suffix


[snip]

how about replacing the existing
text ("It does not make sense to use this feature with a non-static
local variable since such variables do not have assembler names.") with
"Do not use this feature with a non-static local variable." or maybe "It
is not supported to use this feature with a non-static local variable
since such variables do not have assembler names."
"You cannot use this feature ..." etc.?  Keep the part about not having
assembler names, it is useful.

Due to the quirks of the English language, I'm not sure 'cannot' is the right word here. More correct would be 'cannot reliably' but I don't want to be that wishy-washy.

And I'm a little iffy about the 'since such variables do not have assembler names,' as it seemed a bit bold to make assertions about the implementation details for all assemblers (past, present and future) for all platforms. But you are right, it does convey a bit of the 'why' for this limitation, so keeping it is a good idea. How about:

"gcc does not support using this feature with a non-static local variable since typically such variables do not have assembler names."

BTW, the trick for getting the "ignoring asm-specifier for non-static local variable" message was renaming my file from sta5.cpp to sta5.c. Seems like this should apply to both, but whatever.

The first part ("must not use a register name") is an important warning.
Clarifying this is a good idea.  Although limiting it to only saying
"don't use register names" seems a little, well, limiting. Who knows
what kind of offsets or asm qualifiers they might try to cram in here?
Register names is the common case to hurt you...  "r0" etc. ;-)

But as we have seen (%gs:4), people are willing to try other things. And rather than try to list all the things that don't work (register, registers with offsets, etc), I'm hoping we can find a way to specify the one thing that is supported.

How about:

"Only label names valid for your assembler are permitted within the asm."
The assembler calls it "symbol names" (labels end in a colon).  But it
won't help: e.g. "r0" is a perfectly fine name for the assembler, too!

It should say something like "if the string you put here is seen as
something else than a symbol name by the assembler, anywhere the compiler
puts it, you're on your own", but that is pretty vague as well.

Ok, how about "Only symbol names that define labels are permitted within the asm."

A bit awkward, but I believe it conveys the intent.

You forgot to make it "register", so it is not a register variable.

Ahh, true. I suppose we could say something about don't use 'register' with 'asm labels', but it doesn't seem worth the effort.

dw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]