Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: gdb-patches@sourceware.org
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH] gdb: Move defs.h before any system header in debuginfod-support.c
Date: Sat, 29 Feb 2020 13:47:00 -0000	[thread overview]
Message-ID: <20200229134648.2833-1-jon.turney@dronecode.org.uk> (raw)

* defs.h includes config.h
* config.h may define _GNU_SOURCE
* if _GNU_SOURCE is defined, that must be before including any system
header (see feature_test_macro(7))

This is necessary to ensure that a prototype for mkostemp() is brought
into scope by <stdlib.h> when compiling filestuff.h, on platforms where
_GNU_SOURCE isn't unconditionally defined for C++ (i.e. not Linux).

In file included from ../../gdb/../gdbsupport/scoped_fd.h:24,
                 from ../../gdb/debuginfod-support.c:22:
../../gdb/../gdbsupport/filestuff.h: In function ‘int gdb_mkostemp_cloexec(char*, int)’:
../../gdb/../gdbsupport/filestuff.h:59:10: error: ‘mkostemp’ was not declared in this scope; did you mean ‘mkstemp’?

gdb/ChangeLog:

2020-02-29  Jon Turney  <jon.turney@dronecode.org.uk>

	* debuginfod-support.c: Include defs.h first.
---
 gdb/ChangeLog            | 4 ++++
 gdb/debuginfod-support.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index e0f0fac076..f4a227b040 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -16,8 +16,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
 #include "defs.h"
+#include <errno.h>
 #include "cli/cli-style.h"
 #include "gdbsupport/scoped_fd.h"
 #include "debuginfod-support.h"
-- 
2.21.0


             reply	other threads:[~2020-02-29 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-29 13:47 Jon Turney [this message]
2020-02-29 14:16 ` Tom Tromey

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

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

  git send-email \
    --in-reply-to=20200229134648.2833-1-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=gdb-patches@sourceware.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