unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Matt Sicker <boards@gmail.com>
To: 15741@debbugs.gnu.org
Subject: bug#15741: Patch for bug #15739
Date: Sun, 27 Oct 2013 17:10:24 -0500	[thread overview]
Message-ID: <CACmp6kp4Gf=ZwyHAPhuCJtV0Xp4DBMhN2O1Uoatt6bMrhiJkCw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 405 bytes --]

I noticed that clang reports to be GCC version 4.2, so most of what I
thought might be wrong wasn't. Therefore, the patch was far easier and
smaller than I expected. This isn't too high a priority, but it does add
support for clang where the code would normally check for GCC 4.3+. Clang
even supports C++ static_assert supposedly, so there's a check for that as
well.

-- 
Matt Sicker <boards@gmail.com>

[-- Attachment #1.2: Type: text/html, Size: 535 bytes --]

[-- Attachment #2: 0001-Updated-a-couple-compiler-checks-to-support-clang.patch --]
[-- Type: application/octet-stream, Size: 2856 bytes --]

From 2b02509f53a247784b4bb0be96061e46b53b0c4e Mon Sep 17 00:00:00 2001
From: Matt Sicker <boards@gmail.com>
Date: Sun, 27 Oct 2013 16:54:06 -0500
Subject: [PATCH] Updated a couple compiler checks to support clang.

* lib/poll.c [__clang__]: Same functionality as GCC 4.3+ for ignoring
  the (nfd < 0) tests.
* lib/verify.h [__has_feature(c_static_assert)]: Enables
  _GL_HAVE__STATIC_ASSERT when clang feature is available for C.
* lib/verify.h [__has_feature(cxx_static_assert)]: Enables
* _GL_HAVE_STATIC_ASSERT when clang feature is available for C++.
* See bug #15739
---
 lib/poll.c   |  4 ++--
 lib/verify.h | 10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/poll.c b/lib/poll.c
index 2767f5a..3b82522 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -18,8 +18,8 @@
    You should have received a copy of the GNU Lesser General Public License along
    with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
-/* Tell gcc not to warn about the (nfd < 0) tests, below.  */
-#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+/* Tell gcc (or clang) not to warn about the (nfd < 0) tests, below.  */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ || defined __clang__
 # pragma GCC diagnostic ignored "-Wtype-limits"
 #endif
 
diff --git a/lib/verify.h b/lib/verify.h
index 40b8ef5..d04e8b2 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -20,23 +20,29 @@
 #ifndef _GL_VERIFY_H
 # define _GL_VERIFY_H
 
+/* Compatibility for non-clang compilers */
+# ifndef __has_feature
+#  define __has_feature(x) 0
+# endif
 
 /* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11.
    This is supported by GCC 4.6.0 and later, in C mode, and its use
    here generates easier-to-read diagnostics when verify (R) fails.
+   This is supported by clang when the c_static_assert feature is set.
 
    Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
    This will likely be supported by future GCC versions, in C++ mode.
+   This is supported by clang when the cxx_static_assert feature is set.
 
    Use this only with GCC.  If we were willing to slow 'configure'
    down we could also use it with other compilers, but since this
    affects only the quality of diagnostics, why bother?  */
-# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
+# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || __has_feature(c_static_assert)) && !defined __cplusplus
 #  define _GL_HAVE__STATIC_ASSERT 1
 # endif
 /* The condition (99 < __GNUC__) is temporary, until we know about the
    first G++ release that supports static_assert.  */
-# if (99 < __GNUC__) && defined __cplusplus
+# if ((99 < __GNUC__) || __has_feature(cxx_static_assert)) && defined __cplusplus
 #  define _GL_HAVE_STATIC_ASSERT 1
 # endif
 
-- 
1.8.4.1


             reply	other threads:[~2013-10-27 22:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-27 22:10 Matt Sicker [this message]
2013-11-01 22:00 ` bug#15739: Doesn't support clang as well as it could Mark H Weaver

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to='CACmp6kp4Gf=ZwyHAPhuCJtV0Xp4DBMhN2O1Uoatt6bMrhiJkCw@mail.gmail.com' \
    --to=boards@gmail.com \
    --cc=15741@debbugs.gnu.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).