Just a quick note on the rationale behind the double parenthesis. IIRC
I read this in the gcc infotex..
The double parens allow __attribute__ to be defined as a
single-argument macro on non-gcc systems, like so:
#ifndef SOME_GCC_FLAG
# define __attribute__(x)
#endif
Ah, but the same would have applied had __attribute__ taken a
string literal. Had __attribute__ been defined like C99's _Pragma:
void insert(struct hashtab *ht, char *key,
char *value __attribute__("unused")) {
one could then use:
#ifndef SOME_GCC_FLAG
# define __attribute__(x) /* empty; remove x */
#endif
Moreover, this fixes a serious problem implementors had with GCC's
"noreturn", "pure", and "format printf". Suppose I, as the provider
of <stdlib.h>, <stdio.h>, and so on, want to declare some function
as "not returning" or "printf-like" (or even both, such as the 4.4BSD
err() and errx(), though there are no Standard C functions that are
both). Suppose I have stdlib.h include the line:
void exit(int) __attribute__((noreturn));
This is all well and good so far, but now suppose a C programmer
writes -- as is her right -- code like this:
#define nodeposit 9
#define noreturn 72
#include <stdlib.h>
Suddenly my __attribute__ line reads, after preprocessing:
void exit(int) __attribute__((72));
which produces an error during compilation.
At some point GCC was modified to add double-underscore versions
of all the attribute names, so that I can write:
void exit(int) __attribute__((__noreturn__));
4.xBSD's err() is, for instance:
void err(int, const char *, ...)
__attribute__((__noreturn__, __format__((__printf__, 2, 3))));
(Admittedly, since this is in the nonstandard <err.h> header, I --
the implementor -- can simply decree that the programmer must not
#define away any of the identifiers "noreturn", "format", and
"printf". But personally I find this restriction ugly and tacky.)
Compare this with my suggested variant:
void err(int, const char *, ...)
__attribute__("noreturn, format(printf, 2, 3)");
(GCC's section("section-name") attribute gets ugly instead,
assuming one takes one's cue from C99. Here we might have
_Pragma("section(\"blah\")") to put a function in the "blah" section.
Then again, there is no reason to require the quotes inside the
parentheses as long as section names are forbidden to contain
parentheses, bringing us back to _Pragma("section(blah)").)
... So there you have it, although it's ugly as hell, there is at
least some half-decent rationale behind it.

</useless-info>
Indeed. Perhaps now that C99 is out, the GNU folks will pick up
on the _Pragma idea, and re-adopt all their __attribute__s as either
_Pragmas or __attribute__-with-string-literal. (The Extremely
Magical Double Parentheses Syntax makes it technically possible to
shoehorn string literals in as well, without breaking backwards
compatibility. I once took a look at what it would take to implement
this, though, and decided it was ugly enough that I would never
get the FSF to buy it back.)