[pushed] gdb: Fix ATTRIBUTE_NONNULL usage

Message ID 1488990075-25616-1-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves March 8, 2017, 4:21 p.m. UTC
  Should fix the build failure with Clang mentioned at
	<https://sourceware.org/bugzilla/show_bug.cgi?id=21206#c2>:

 In file included from ../../binutils-gdb/gdb/dwarf2read.c:72:
 ../../binutils-gdb/gdb/common/gdb_unlinker.h:35:35: error: '__nonnull__' attribute is invalid for the implicit this argument
   unlinker (const char *filename) ATTRIBUTE_NONNULL (1)
				   ^                  ~
 ../../binutils-gdb/gdb/../include/ansidecl.h:169:48: note: expanded from macro 'ATTRIBUTE_NONNULL'
 #  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))

gdb/ChangeLog:
2017-03-08  Pedro Alves  <palves@redhat.com>

	PR 21206
	* common/gdb_unlinker.h (unlinker::unlinker): Attribute nonnull
	goes to argument 2, not 1.
---
 gdb/ChangeLog             | 6 ++++++
 gdb/common/gdb_unlinker.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92847f7..ce37aa7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2017-03-08  Pedro Alves  <palves@redhat.com>
 
+	PR 21206
+	* common/gdb_unlinker.h (unlinker::unlinker): Attribute nonnull
+	goes to argument 2, not 1.
+
+2017-03-08  Pedro Alves  <palves@redhat.com>
+
 	PR cli/21218
 	* top.c (gdb_readline_wrapper): Avoid passing NULL to
 	display_gdb_prompt.
diff --git a/gdb/common/gdb_unlinker.h b/gdb/common/gdb_unlinker.h
index 0f3b98a..e93fa79 100644
--- a/gdb/common/gdb_unlinker.h
+++ b/gdb/common/gdb_unlinker.h
@@ -32,7 +32,7 @@  class unlinker
 {
  public:
 
-  unlinker (const char *filename) ATTRIBUTE_NONNULL (1)
+  unlinker (const char *filename) ATTRIBUTE_NONNULL (2)
     : m_filename (filename)
   {
     gdb_assert (filename != NULL);