diff options
author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2016-10-28 09:52:12 +0300 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2016-10-31 12:39:09 +0100 |
commit | 00d1e6c75e0a3317331e2e8a9d3e426f0cdc8584 (patch) | |
tree | 15b7ccbc344bc361f5bf1611e373a3e4f2dcb914 /tools | |
parent | f20ba0f0d59dabc1a61864f35bd6e57f6ee0aab7 (diff) | |
download | mtk-20170518-00d1e6c75e0a3317331e2e8a9d3e426f0cdc8584.zip mtk-20170518-00d1e6c75e0a3317331e2e8a9d3e426f0cdc8584.tar.gz mtk-20170518-00d1e6c75e0a3317331e2e8a9d3e426f0cdc8584.tar.bz2 |
firmware-utils: fix compilation on MacOS X
Looking into /usr/include/stdlib.h, there's a `devname()` function defined
under some #ifdef's which conflicts with the `static char *devname` definition
in `src/mkwrggimg.c`.
Defining `_ANSI_SOURCE` in the `src/mkwrggimg.c` file, omits that part of the
header.
Another more intrusive approach is to rename `devname` to something like
`g_devname` in `src/mkwrggimg.c`. But I think the `_ANSI_SOURCE` define should
be enough.
Compilation error is:
src/mkwrggimg.c:64:14: error: redefinition of 'devname' as different kind of symbol
static char *devname;
^
/usr/include/stdlib.h:286:7: note: previous definition is here
char *devname(dev_t, mode_t);
^
src/mkwrggimg.c:147:12: error: non-object type 'char *(dev_t, mode_t)' (aka 'char *(int, unsigned short)') is not assignable
devname = optarg;
~~~~~~~ ^
src/mkwrggimg.c:192:6: warning: comparison of function 'devname' equal to a null pointer is always false [-Wtautological-pointer-compare]
if (devname == NULL) {
^~~~~~~ ~~~~
src/mkwrggimg.c:192:6: note: prefix with the address-of operator to silence this warning
if (devname == NULL) {
^
&
src/mkwrggimg.c:251:27: warning: incompatible pointer types passing 'char *(dev_t, mode_t)' (aka 'char *(int, unsigned short)') to parameter of type 'const char *' [-Wincompatible-pointer-types]
strncpy(header->devname, devname, sizeof(header->devname));
^~~~~~~
/usr/include/secure/_string.h:119:34: note: expanded from macro 'strncpy'
__builtin___strncpy_chk (dest, src, len, __darwin_obsz (dest))
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
[Jo-Philipp Wich: slightly reformat commit message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/firmware-utils/src/mkwrggimg.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/firmware-utils/src/mkwrggimg.c b/tools/firmware-utils/src/mkwrggimg.c index a224b25..9995b9a 100644 --- a/tools/firmware-utils/src/mkwrggimg.c +++ b/tools/firmware-utils/src/mkwrggimg.c @@ -8,6 +8,7 @@ * */ +#define _ANSI_SOURCE #include <stdio.h> #include <stdlib.h> #include <stdint.h> |