gdb: Move defs.h before any system header in debuginfod-support.c
authorJon Turney <jon.turney@dronecode.org.uk>
Sat, 29 Feb 2020 13:33:35 +0000 (13:33 +0000)
committerJon Turney <jon.turney@dronecode.org.uk>
Mon, 2 Mar 2020 12:59:44 +0000 (12:59 +0000)
* 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++.

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
gdb/debuginfod-support.c

index 5f49542fb8237cf2073c77e43b1a52a03ec9a26c..591ef40286361cd79f8c7ee9817fc37b15524aa2 100644 (file)
@@ -1,3 +1,7 @@
+2020-02-29  Jon Turney  <jon.turney@dronecode.org.uk>
+
+       * debuginfod-support.c: Include defs.h first.
+
 2020-02-28  Tom de Vries  <tdevries@suse.de>
 
        * symfile.c (set_initial_language): Use default language for lookup.
index e0f0fac07665ec2a3579f1f9004da7b657f0bacb..f4a227b0403b1cb95e14f4de783705fd3862c0e9 100644 (file)
@@ -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"