[RFC PATCH 8/9] lib: use -std=c++0x -pedantic

Subject: [RFC PATCH 8/9] lib: use -std=c++0x -pedantic

Date: Sun, 8 Jan 2012 01:26:22 +0200

To: notmuch@notmuchmail.org

Cc:

From: Jani Nikula


Introduces warnings such as:

In file included from /usr/include/gmime-2.4/gmime/gmime.h:39:0,
                 from lib/database.cc:31:
/usr/include/gmime-2.4/gmime/gmime-message.h:57:26: warning: comma at end of enumerator list [-pedantic]

Signed-off-by: Jani Nikula <jani@nikula.org>
---
 configure             |    2 +-
 lib/database.cc       |    3 +--
 lib/message.cc        |    2 +-
 lib/notmuch-private.h |    8 +++++---
 lib/thread.cc         |    2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index f84262d..30831f3 100755
--- a/configure
+++ b/configure
@@ -26,7 +26,7 @@ fi
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
 CFLAGS=${CFLAGS:--O2 -std=c99 -pedantic}
-CXXFLAGS=${CXXFLAGS:--O2}
+CXXFLAGS=${CXXFLAGS:--O2 -std=c++0x -pedantic}
 LDFLAGS=${LDFLAGS:-}
 XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
 
diff --git a/lib/database.cc b/lib/database.cc
index 8103bd9..b59497b 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1352,8 +1352,7 @@ _resolve_message_id_to_thread_id (notmuch_database_t *notmuch,
 	return status;
 
     if (message) {
-	*thread_id_ret = talloc_steal (ctx,
-				       notmuch_message_get_thread_id (message));
+	*thread_id_ret = (const char *) _talloc_steal_loc (ctx, notmuch_message_get_thread_id (message), __location__);
 
 	notmuch_message_destroy (message);
 
diff --git a/lib/message.cc b/lib/message.cc
index 0075425..ed7398a 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -220,7 +220,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
 									    message_id,
 									    &message);
     if (message)
-	return talloc_steal (notmuch, message);
+	return (notmuch_message_t *) _talloc_steal_loc (notmuch, message, __location__);
     else if (*status_ret)
 	return NULL;
 
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 60a932f..7694705 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -137,15 +137,17 @@ typedef enum _notmuch_private_status {
  * that the caller has previously handled any expected
  * notmuch_private_status_t values.)
  */
-#define COERCE_STATUS(private_status, format, ...)			\
+#define _COERCE_STATUS(private_status, format, ...)			\
     ((private_status >= (notmuch_private_status_t) NOTMUCH_STATUS_LAST_STATUS)\
      ?									\
-     (notmuch_status_t) _internal_error (format " (%s).\n",		\
-                                         ##__VA_ARGS__,			\
+     (notmuch_status_t) _internal_error (format "%s (%s).\n",		\
+                                         __VA_ARGS__,			\
                                          __location__)			\
      :									\
      (notmuch_status_t) private_status)
 
+#define COERCE_STATUS(private_status, ...) _COERCE_STATUS(private_status, __VA_ARGS__, "")
+
 typedef struct _notmuch_doc_id_set notmuch_doc_id_set_t;
 
 /* database.cc */
diff --git a/lib/thread.cc b/lib/thread.cc
index 0435ee6..e8f169c 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -224,7 +224,7 @@ _thread_add_message (notmuch_thread_t *thread,
     char *clean_author;
 
     _notmuch_message_list_add_message (thread->message_list,
-				       talloc_steal (thread, message));
+				       (notmuch_message_t *) _talloc_steal_loc (thread, message, __location__));
     thread->total_messages++;
 
     g_hash_table_insert (thread->message_hash,
-- 
1.7.5.4


Thread: