On Fri, 2013-10-11 at 19:53 +0200, Marc Glisse wrote:
> With the patch now...

[...]

> -extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL;
> +extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL 
> ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURNS_NONNULL;

An aesthetic idea: should the attributes be ordered to reflect the order
that the related entities appear in the declaration?  Return types
appear before parameters in declarations, and thus perhaps the
attributes describing them should also.

This would make the above look like this (introducing a newline to avoid
overlong lines):

extern char *concat_copy (char *, const char *, ...)
  ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;

Such runs of blockcaps might be made more readable by adding newlines:

extern char *concat_copy (char *, const char *, ...)
  ATTRIBUTE_RETURNS_NONNULL
  ATTRIBUTE_NONNULL(1)
  ATTRIBUTE_SENTINEL;

FWIW I do something like this with custom attributes in my
gcc-python-plugin, see e.g.:
https://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html#marking-functions-that-steal-references-to-their-arguments

Thoughts?
Dave

Reply via email to