public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: newlib@sourceware.org
Subject: [PATCH] Revert "headers: avoid bareword attributes" for clang
Date: Fri, 25 Aug 2017 16:02:00 -0000	[thread overview]
Message-ID: <20170825142438.24525-1-eblake@redhat.com> (raw)

This reverts most of commit 979d467ff6e39ee5c52cf1aac7a6c9c63058141c.

We cannot avoid some bareword attributes until clang is fixed to
properly support __-decorated attributes; see this bug:
https://bugs.llvm.org/show_bug.cgi?id=34319

The macros in question expand to the empty string under gcc, so
only compilation under clang is affected, and since clang has the
bug, the obvious solution is to roll back the changes, and document
the issue.

Signed-off-by: Eric Blake <eblake@redhat.com>
---

I'm pushing this as a result of Sebastian's investigations.

 newlib/libc/include/sys/cdefs.h | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 9e58ee980..8ce14b68e 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -681,42 +681,44 @@
 #endif

 /* Structure implements a lock. */
-#define	__lockable		__lock_annotate(__lockable__)
+/* FIXME: Use __lockable__, etc. to avoid colliding with user namespace macros,
+ * once clang is fixed: https://bugs.llvm.org/show_bug.cgi?id=34319 */
+#define	__lockable		__lock_annotate(lockable)

 /* Function acquires an exclusive or shared lock. */
 #define	__locks_exclusive(...) \
-	__lock_annotate(__exclusive_lock_function__(__VA_ARGS__))
+	__lock_annotate(exclusive_lock_function(__VA_ARGS__))
 #define	__locks_shared(...) \
-	__lock_annotate(__shared_lock_function__(__VA_ARGS__))
+	__lock_annotate(shared_lock_function(__VA_ARGS__))

 /* Function attempts to acquire an exclusive or shared lock. */
 #define	__trylocks_exclusive(...) \
-	__lock_annotate(__exclusive_trylock_function__(__VA_ARGS__))
+	__lock_annotate(exclusive_trylock_function(__VA_ARGS__))
 #define	__trylocks_shared(...) \
-	__lock_annotate(__shared_trylock_function__(__VA_ARGS__))
+	__lock_annotate(shared_trylock_function(__VA_ARGS__))

 /* Function releases a lock. */
-#define	__unlocks(...)		__lock_annotate(__unlock_function__(__VA_ARGS__))
+#define	__unlocks(...)		__lock_annotate(unlock_function(__VA_ARGS__))

 /* Function asserts that an exclusive or shared lock is held. */
 #define	__asserts_exclusive(...) \
-	__lock_annotate(__assert_exclusive_lock__(__VA_ARGS__))
+	__lock_annotate(assert_exclusive_lock(__VA_ARGS__))
 #define	__asserts_shared(...) \
-	__lock_annotate(__assert_shared_lock__(__VA_ARGS__))
+	__lock_annotate(assert_shared_lock(__VA_ARGS__))

 /* Function requires that an exclusive or shared lock is or is not held. */
 #define	__requires_exclusive(...) \
-	__lock_annotate(__exclusive_locks_required__(__VA_ARGS__))
+	__lock_annotate(exclusive_locks_required(__VA_ARGS__))
 #define	__requires_shared(...) \
-	__lock_annotate(__shared_locks_required__(__VA_ARGS__))
+	__lock_annotate(shared_locks_required(__VA_ARGS__))
 #define	__requires_unlocked(...) \
-	__lock_annotate(__locks_excluded__(__VA_ARGS__))
+	__lock_annotate(locks_excluded(__VA_ARGS__))

 /* Function should not be analyzed. */
-#define	__no_lock_analysis	__lock_annotate(__no_thread_safety_analysis__)
+#define	__no_lock_analysis	__lock_annotate(no_thread_safety_analysis)

 /* Guard variables and structure members by lock. */
-#define	__guarded_by(x)		__lock_annotate(__guarded_by__(x))
-#define	__pt_guarded_by(x)	__lock_annotate(__pt_guarded_by__(x))
+#define	__guarded_by(x)		__lock_annotate(guarded_by(x))
+#define	__pt_guarded_by(x)	__lock_annotate(pt_guarded_by(x))

 #endif /* !_SYS_CDEFS_H_ */
-- 
2.13.5

                 reply	other threads:[~2017-08-25 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170825142438.24525-1-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).