keynav icon indicating copy to clipboard operation
keynav copied to clipboard

Fix compiler warning: implicit declaration of asprintf

Open yjftsjthsd-g opened this issue 7 years ago • 2 comments

Currently, compiling on GNU/Linux systems throws, "keynav.c:376:9: warning: implicit declaration of function 'asprintf'". This does not break the build and does not appear on FreeBSD. It appears that asprintf is a GNU extension also implemented by some or all BSDs. There are two ways to resolve this: We can either 1. refactor the code to not use asprintf (it appears that its functionality can be replaced with calloc+sprintf), or 2. just say that we're using GNU extensions (this is done by one other keynav fork; see https://github.com/dradetsky/keynav/commit/247d1a6f1d9dd561f3f6f24f7dde050ac055497f)

yjftsjthsd-g avatar Jun 17 '17 18:06 yjftsjthsd-g

Using #define _GNU_SOURCE does compile fine on FreeBSD at least, but it is still a non-standard extension not defined by C or POSIX.

yjftsjthsd-g avatar Jun 17 '17 18:06 yjftsjthsd-g

Oh, it will matter; according to jordansissel, "asprintf is not available on Solaris (by default)".

(see https://github.com/jordansissel/keynav/pull/23)

yjftsjthsd-g avatar Nov 27 '17 01:11 yjftsjthsd-g