Re: Compilation failure for mingw64 target (was New ARI warning Fri Mar 15 02:02:12 UTC 2013 in -D 2013-03-15-gmt)

Yao Qi
2013-03-15T11:06:18Z

Sorry for breaking the build for mingw target.

On 03/15/2013 05:48 PM, Pierre Muller wrote:
> ../../src/gdb/ctf.c: In function 'ctf_save_metadata_header':
> ../../src/gdb/ctf.c:223:7: erreur: 'BYTE_ORDER' undeclared (first use in this fu
> nction)
> ../../src/gdb/ctf.c:223:7: note: each undeclared identifier is reported only onc
> e for each function it appears in
> ../../src/gdb/ctf.c:223:21: erreur: 'LITTLE_ENDIAN' undeclared (first use in thi
> s function)

This problem is addressed by using "native" endianness in CTF metadata,
so BYTE_ORDER and LITTLE_ENDIAN can be avoided.

> ../../src/gdb/ctf.c: In function 'ctf_start':
> ../../src/gdb/ctf.c:279:33: erreur: 'S_IRGRP' undeclared (first use in this func
> tion)
> ../../src/gdb/ctf.c:279:43: erreur: 'S_IXGRP' undeclared (first use in this func
> tion)
> ../../src/gdb/ctf.c:279:53: erreur: 'S_IROTH' undeclared (first use in this func
> tion)
> ../../src/gdb/ctf.c:279:63: erreur: 'S_IXOTH' undeclared (first use in this func
> tion)

These modes are not necessary. Removed.

> ../../src/gdb/ctf.c:279:3: erreur: too many arguments to function 'mkdir'

Fixed.

The patch below fix these errors for i686-pc-mingw32 target. It should
also fix your errors for mingw64 target (I don't have mingw64 toolchain
on hand).

--
Yao (é½å°§)

gdb:

2013-03-15 Yao Qi <yao@codesourcery.com>

* ctf.c (ctf_save_metadata_header): Save CTF in native
endianness.
(ctf_start) [USE_WIN32API]: Call mkdir with DIRNAME only.
[!USE_WIN32API]: Call mkdir with DIRNAME and mode parameter.
---
gdb/ctf.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gdb/ctf.c b/gdb/ctf.c
index 44c4e9e..05022b7 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -194,7 +194,7 @@ ctf_save_metadata_header (struct trace_write_handler *handler)
"\ntrace {\n"
" major = %u;\n"
" minor = %u;\n"
- " byte_order = %s;\n" /* be or le */
+ " byte_order = native;\n"
" packet.header := struct {\n"
" uint32_t magic;\n"
" };\n"
@@ -243,8 +243,7 @@ ctf_save_metadata_header (struct trace_write_handler *handler)
ctf_save_write_metadata (handler, "\n");

ctf_save_write_metadata (handler, metadata_fmt,
- CTF_SAVE_MAJOR, CTF_SAVE_MINOR,
- BYTE_ORDER == LITTLE_ENDIAN ? "le" : "be");
+ CTF_SAVE_MAJOR, CTF_SAVE_MINOR);
ctf_save_write_metadata (handler, "\n");
}

@@ -298,10 +297,16 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
struct ctf_trace_file_writer *writer
= (struct ctf_trace_file_writer *) self;
int i;
+ int ret = 0;

/* Create DIRNAME. */
- if (mkdir (dirname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
- && errno != EEXIST)
+#ifdef USE_WIN32API
+ ret = mkdir (dirname);
+#else
+ ret = mkdir (dirname, S_IRUSR | S_IWUSR | S_IXUSR);
+#endif
+
+ if (ret && errno != EEXIST)
error (_("Unable to open directory '%s' for saving trace data (%s)"),
dirname, safe_strerror (errno));

--
1.7.7.6