Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Move include block to pathstuff.h (no-tn-check)
@ 2020-11-10 16:57 Tom Tromey
  2020-11-10 17:14 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2020-11-10 16:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

A recent commit caused pathstuff.cc to fail to compile on mingw, like:

../../binutils-gdb/gdbsupport/pathstuff.cc:324:1: error: no previous declaration for 'std::string find_gdb_home_config_file(const char*, _stati64*)' [-Werror=missing-declarations]

Some newly-added #includes were changing which "stat" was being seen
by the compiler.  This patch moves the includes to the header, so that
the declaration and definition now agree.

gdbsupport/ChangeLog
2020-11-10  Tom Tromey  <tromey@adacore.com>

	* pathstuff.h: Move include block here...
	* pathstuff.cc: ... from here.
---
 gdbsupport/ChangeLog    | 5 +++++
 gdbsupport/pathstuff.cc | 4 ----
 gdbsupport/pathstuff.h  | 4 ++++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc
index a52e53b8671..311456720e4 100644
--- a/gdbsupport/pathstuff.cc
+++ b/gdbsupport/pathstuff.cc
@@ -23,10 +23,6 @@
 #include "filenames.h"
 #include "gdb_tilde_expand.h"
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
 #ifdef USE_WIN32API
 #include <windows.h>
 #endif
diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
index 996c8f2bbf6..7e35f62c78c 100644
--- a/gdbsupport/pathstuff.h
+++ b/gdbsupport/pathstuff.h
@@ -22,6 +22,10 @@
 
 #include "gdbsupport/byte-vector.h"
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 /* Path utilities.  */
 
 /* Return the real path of FILENAME, expanding all the symbolic links.
-- 
2.26.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Move include block to pathstuff.h (no-tn-check)
  2020-11-10 16:57 [PATCH] Move include block to pathstuff.h (no-tn-check) Tom Tromey
@ 2020-11-10 17:14 ` Simon Marchi
  2020-11-10 20:11   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-11-10 17:14 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 2020-11-10 11:57 a.m., Tom Tromey wrote:
> A recent commit caused pathstuff.cc to fail to compile on mingw, like:
>
> ../../binutils-gdb/gdbsupport/pathstuff.cc:324:1: error: no previous declaration for 'std::string find_gdb_home_config_file(const char*, _stati64*)' [-Werror=missing-declarations]
>
> Some newly-added #includes were changing which "stat" was being seen
> by the compiler.  This patch moves the includes to the header, so that
> the declaration and definition now agree.
>
> gdbsupport/ChangeLog
> 2020-11-10  Tom Tromey  <tromey@adacore.com>
>
> 	* pathstuff.h: Move include block here...
> 	* pathstuff.cc: ... from here.

Does this fix this bug?

https://sourceware.org/bugzilla/show_bug.cgi?id=26848

If so, you could add a PR reference and close it.  The patch LGTM, since
we reached the same conclusion.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Move include block to pathstuff.h (no-tn-check)
  2020-11-10 17:14 ` Simon Marchi
@ 2020-11-10 20:11   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2020-11-10 20:11 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches, Tom Tromey

>> gdbsupport/ChangeLog
>> 2020-11-10  Tom Tromey  <tromey@adacore.com>
>> 
>> * pathstuff.h: Move include block here...
>> * pathstuff.cc: ... from here.

Simon> Does this fix this bug?

Yep, thanks.

Simon> https://sourceware.org/bugzilla/show_bug.cgi?id=26848

Simon> If so, you could add a PR reference and close it.  The patch LGTM, since
Simon> we reached the same conclusion.

Will do, thank you.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-10 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 16:57 [PATCH] Move include block to pathstuff.h (no-tn-check) Tom Tromey
2020-11-10 17:14 ` Simon Marchi
2020-11-10 20:11   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox