public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA:] alignof documentation shouldn't say it's a recommendation for non-strict-alignment targets
@ 2008-03-10 20:39 Hans-Peter Nilsson
  2008-03-16 14:58 ` Mark Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Hans-Peter Nilsson @ 2008-03-10 20:39 UTC (permalink / raw)
  To: gcc-patches

I've been alerted by a user that the GCC documentation
special-cases !STRICT_ALIGNMENT targets; it says __alignof__
reports "recommended" alignment.  That's bogus; GCC doesn't give
recommendations, it just tells what it does itself.  The
doubtful may find comfort in the comment above c-common.c:
c_alignof_expr: "Implement the __alignof keyword: Return the
minimum required alignment of EXPR, measured in bytes."

And of course, there's no target "recommendation" macro, so
there's no way to pass a recommendation down there from the
target description.  FWIW, I was unable to follow extend.texi
beyond the move to the doc subdir so I don't know where the
wording "recommended" comes from.

Here's a fix, instead hinting that the target ABI may have a say
in the alignment, like happens for x86, but still giving leeway
to port maintainers for increasing the alignment (though it'd
probably clash with a defined ABI).  I considered the @acronym
markup for "ABI", but as that's not done for other occurrences
in this file, it didn't seem appropriate.

Checked with "make info-gcc dvi-gcc" and inspecting the output
and complaints.

Ok to commit to trunk and 4.3?

	* doc/extend.texi (Alignment): Say that the ABI controls
	the __alignof__ for non-strict-alignment targets rather
	than being a recommendation.

Index: extend.texi
===================================================================
--- extend.texi	(revision 133082)
+++ extend.texi	(working copy)
@@ -3380,7 +3380,8 @@ designs, @code{__alignof__ (double)} is 
 
 Some machines never actually require alignment; they allow reference to any
 data type even at an odd address.  For these machines, @code{__alignof__}
-reports the @emph{recommended} alignment of a type.
+reports the smallest alignment that GCC will give the data type, usually as
+mandated by the target ABI.
 
 If the operand of @code{__alignof__} is an lvalue rather than a type,
 its value is the required alignment for its type, taking into account

brgds, H-P

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA:] alignof documentation shouldn't say it's a recommendation  for non-strict-alignment targets
  2008-03-10 20:39 [RFA:] alignof documentation shouldn't say it's a recommendation for non-strict-alignment targets Hans-Peter Nilsson
@ 2008-03-16 14:58 ` Mark Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2008-03-16 14:58 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

Hans-Peter Nilsson wrote:

> Ok to commit to trunk and 4.3?
> 
> 	* doc/extend.texi (Alignment): Say that the ABI controls
> 	the __alignof__ for non-strict-alignment targets rather
> 	than being a recommendation.

OK, thanks.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-16 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-10 20:39 [RFA:] alignof documentation shouldn't say it's a recommendation for non-strict-alignment targets Hans-Peter Nilsson
2008-03-16 14:58 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).