* LIBNOTMUCH_CHECK_VERSION macro broken
@ 2016-06-06 12:45 Richard Russon
2016-06-06 14:58 ` [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION David Bremner
0 siblings, 1 reply; 5+ messages in thread
From: Richard Russon @ 2016-06-06 12:45 UTC (permalink / raw)
To: notmuch
In <notmuch.h> the macro definition begins:
#define LIBNOTMUCH_CHECK_VERSION (major, minor, micro)
There shouldn't be a space before the (
This is from the current version in git.
Cheers,
Rich / FlatCap
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION
2016-06-06 12:45 LIBNOTMUCH_CHECK_VERSION macro broken Richard Russon
@ 2016-06-06 14:58 ` David Bremner
2016-06-06 15:03 ` David Bremner
0 siblings, 1 reply; 5+ messages in thread
From: David Bremner @ 2016-06-06 14:58 UTC (permalink / raw)
To: Richard Russon, notmuch
Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org
Although the C99 standard 6.10 is a little non-obvious on this point,
the docs for e.g. gcc are unambiguous. And indeed in practice with the
extra space, this code fails
int main(int argc, char **argv){
printf("%d\n",foo(1));
}
---
lib/notmuch.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 29713ae..d4a97cb 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -93,7 +93,7 @@ NOTMUCH_BEGIN_DECLS
* #endif
* @endcode
*/
-#define LIBNOTMUCH_CHECK_VERSION (major, minor, micro) \
+#define LIBNOTMUCH_CHECK_VERSION(major, minor, micro) \
(LIBNOTMUCH_MAJOR_VERSION > (major) || \
(LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION > (minor)) || \
(LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION == (minor) && \
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION
2016-06-06 14:58 ` [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION David Bremner
@ 2016-06-06 15:03 ` David Bremner
2016-06-07 10:37 ` David Bremner
0 siblings, 1 reply; 5+ messages in thread
From: David Bremner @ 2016-06-06 15:03 UTC (permalink / raw)
To: notmuch
David Bremner <david@tethera.net> writes:
> Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org
>
> Although the C99 standard 6.10 is a little non-obvious on this point,
> the docs for e.g. gcc are unambiguous. And indeed in practice with the
> extra space, this code fails
>
> int main(int argc, char **argv){
> printf("%d\n",foo(1));
> }
> ---
Of course git removed the #define as a comment. sigh.
d
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION
2016-06-06 15:03 ` David Bremner
@ 2016-06-07 10:37 ` David Bremner
2016-06-11 16:23 ` David Bremner
0 siblings, 1 reply; 5+ messages in thread
From: David Bremner @ 2016-06-07 10:37 UTC (permalink / raw)
To: David Bremner, notmuch
Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org
Although the C99 standard 6.10 is a little non-obvious on this point,
the docs for e.g. gcc are unambiguous. And indeed in practice with the
extra space, this code fails
#include <stdio.h>
#define foo (x) (x+1)
int main(int argc, char **argv){
printf("%d\n",foo(1));
}
---
lib/notmuch.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 29713ae..d4a97cb 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -93,7 +93,7 @@ NOTMUCH_BEGIN_DECLS
* #endif
* @endcode
*/
-#define LIBNOTMUCH_CHECK_VERSION (major, minor, micro) \
+#define LIBNOTMUCH_CHECK_VERSION(major, minor, micro) \
(LIBNOTMUCH_MAJOR_VERSION > (major) || \
(LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION > (minor)) || \
(LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION == (minor) && \
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION
2016-06-07 10:37 ` David Bremner
@ 2016-06-11 16:23 ` David Bremner
0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2016-06-11 16:23 UTC (permalink / raw)
To: notmuch
David Bremner <david@tethera.net> writes:
> Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org
>
> Although the C99 standard 6.10 is a little non-obvious on this point,
> the docs for e.g. gcc are unambiguous. And indeed in practice with the
> extra space, this code fails
>
Pushed to master.
d
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-11 16:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-06 12:45 LIBNOTMUCH_CHECK_VERSION macro broken Richard Russon
2016-06-06 14:58 ` [PATCH] lib: fix definition of LIBNOTMUCH_CHECK_VERSION David Bremner
2016-06-06 15:03 ` David Bremner
2016-06-07 10:37 ` David Bremner
2016-06-11 16:23 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
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).