__unused is indeed not valid C and needs to be fixed. But I think
__attribute__ ((unused)) says the entire function may be unused, not that
the parameters can be unused. For the actual usage, it seems one of the
functions is actually used so there it can be removed. The other two
functions really seems to be unused so there we'll have to either find out
why and start using them, or remove them from compilation or even
completely.

/Andreas

On Mon, Apr 24, 2017 at 7:47 AM, Freddie Chopin <freddie-cho...@users.sf.net
> wrote:

> I think we should change the name of __unused to just unused or maybe
> UNUSED. Traditionally all names beginning with double underscore (and
> underscore followed by capital letter) are reserved for compiler.
>
> Another option is to just drop it, as it seems to me that OpenOCD disables
> warnings about unused arguments anyway (-Wno-unused-parameter is used in
> configure script).
> ------------------------------
>
> * [tickets:#151] <https://sourceforge.net/p/openocd/tickets/151/> OpenOCD
> fails to build on macOS due to redefined macro*
>
> *Status:* new
> *Milestone:* 0.9.0
> *Created:* Sun Apr 23, 2017 10:07 PM UTC by Girts F
> *Last Updated:* Sun Apr 23, 2017 10:07 PM UTC
> *Owner:* nobody
>
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I./src -I./src -I./src/helper 
> -DPKGDATADIR=\"/usr/local/share/openocd\" -DBINDIR=\"/usr/local/bin\" 
> -I./jimtcl -I./jimtcl -Wall -Wstrict-prototypes -Wformat-security -Wshadow 
> -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align 
> -Wredundant-decls -Werror -g -O2 -MT 
> src/target/openrisc/or1k_tap_xilinx_bscan.lo -MD -MP -MF 
> src/target/openrisc/.deps/or1k_tap_xilinx_bscan.Tpo -c 
> src/target/openrisc/or1k_tap_xilinx_bscan.c -o 
> src/target/openrisc/or1k_tap_xilinx_bscan.osrc/target/aarch64.c:33:9: error: 
> '__unused' macro redefined [-Werror,-Wmacro-redefined]#define __unused 
> __attribute((unused))
>         
> ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/cdefs.h:161:9:
>  note: previous
>       definition is here#define __unused        __attribute__((unused))
>         ^1 error generated./bin/sh ./libtool  --tag=CC   --mode=compile gcc 
> -DHAVE_CONFIG_H -I.   -I./src -I./src -I./src/helper 
> -DPKGDATADIR=\"/usr/local/share/openocd\" -DBINDIR=\"/usr/local/bin\" 
> -I./jimtcl -I./jimtcl  -Wall -Wstrict-prototypes -Wformat-security -Wshadow 
> -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align 
> -Wredundant-decls -Werror  -g -O2 -MT 
> src/server/src_server_libserver_la-telnet_server.lo -MD -MP -MF 
> src/server/.deps/src_server_libserver_la-telnet_server.Tpo -c -o 
> src/server/src_server_libserver_la-telnet_server.lo `test -f 
> 'src/server/telnet_server.c' || echo './'`src/server/telnet_server.cmake[2]: 
> *** [src/target/aarch64.lo] Error 1
>
> This is on macOS 10.12.4 at commit 8addd9503eeb7704907d2340378d12
> 00e3bbb99c.
>
> CC version:
>
> $ gcc --version
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
> --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
> Apple LLVM version 8.1.0 (clang-802.0.42)
> Target: x86_64-apple-darwin16.5.0
> Thread model: posix
> InstalledDir: 
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>
> ------------------------------
>
> Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is
> subscribed to https://sourceforge.net/p/openocd/tickets/
>
> To unsubscribe from further messages, a project admin can change settings
> at https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this
> is a mailing list, you can unsubscribe from the mailing list.
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> OpenOCD-devel mailing list
> OpenOCD-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openocd-devel
>
>



---

** [tickets:#151] OpenOCD fails to build on macOS due to redefined macro**

**Status:** new
**Milestone:** 0.9.0
**Created:** Sun Apr 23, 2017 10:07 PM UTC by Girts F
**Last Updated:** Mon Apr 24, 2017 05:47 AM UTC
**Owner:** nobody


~~~
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I./src -I./src -I./src/helper 
-DPKGDATADIR=\"/usr/local/share/openocd\" -DBINDIR=\"/usr/local/bin\" 
-I./jimtcl -I./jimtcl -Wall -Wstrict-prototypes -Wformat-security -Wshadow 
-Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align 
-Wredundant-decls -Werror -g -O2 -MT 
src/target/openrisc/or1k_tap_xilinx_bscan.lo -MD -MP -MF 
src/target/openrisc/.deps/or1k_tap_xilinx_bscan.Tpo -c 
src/target/openrisc/or1k_tap_xilinx_bscan.c -o 
src/target/openrisc/or1k_tap_xilinx_bscan.o
src/target/aarch64.c:33:9: error: '__unused' macro redefined 
[-Werror,-Wmacro-redefined]
#define __unused __attribute((unused))
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/cdefs.h:161:9:
 note: previous
      definition is here
#define __unused        __attribute__((unused))
        ^
1 error generated.
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.   -I./src 
-I./src -I./src/helper -DPKGDATADIR=\"/usr/local/share/openocd\" 
-DBINDIR=\"/usr/local/bin\" -I./jimtcl -I./jimtcl  -Wall -Wstrict-prototypes 
-Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast 
-Wcast-align -Wredundant-decls -Werror  -g -O2 -MT 
src/server/src_server_libserver_la-telnet_server.lo -MD -MP -MF 
src/server/.deps/src_server_libserver_la-telnet_server.Tpo -c -o 
src/server/src_server_libserver_la-telnet_server.lo `test -f 
'src/server/telnet_server.c' || echo './'`src/server/telnet_server.c
make[2]: *** [src/target/aarch64.lo] Error 1
~~~
This is on macOS 10.12.4 at commit 8addd9503eeb7704907d2340378d1200e3bbb99c.

CC version:
~~~
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
~~~


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to