On Thu, 1 Apr 2021 01:36:01 GMT, Alexander Matveev <almat...@openjdk.org> wrote:
>> I get a compilation error on Linux: >> >> ../../../gstreamer-lite/gst-plugins-base/gst-libs/gst/audio/audio-buffer.c: >> In function 'gst_audio_buffer_map': >> ../../../gstreamer-lite/gst-plugins-base/gst-libs/gst/audio/audio-buffer.c:158:7: >> error: implicit declaration of function 'memset' >> [-Werror=implicit-function-declaration] >> 158 | memset (buffer->map_infos, 0, >> | ^~~~~~ >> ../../../gstreamer-lite/gst-plugins-base/gst-libs/gst/audio/audio-buffer.c:158:7: >> warning: incompatible implicit declaration of built-in function 'memset' >> ../../../gstreamer-lite/gst-plugins-base/gst-libs/gst/audio/audio-buffer.c:26:1: >> note: include '<string.h>' or provide a declaration of 'memset' >> ... >> cc1: some warnings being treated as errors >> Makefile:270: recipe for target >> 'modules/javafx.media/build/native/linux/Release/obj/gstreamer-lite/gst-plugins-base/gst-libs/gst/audio/audio-buffer.o' >> failed >> make: *** >> [modules/javafx.media/build/native/linux/Release/obj/gstreamer-lite/gst-plugins-base/gst-libs/gst/audio/audio-buffer.o] >> Error 1 >> >> This is with the gcc 10.2 compiler used for production builds. > > I cannot reproduce build failure on Linux. It compiles for me (on gcc-9, 10.1 and 10.2) but I can imagine it doesn't compile on all configurations. `memset` is declared in `string.h` and that may or may not be included. Running gcc -H shows that on my system, `string.h` is included by `glib-2.0/glib/gtestutils.h` (which is included by `glib-2.0/glib.h`) but on other systems, that might not be the case. Since this PR introduces `memset` in the `audio-buffer.c` file, I think it is safest to include `string.h` in this file as well, as this removes the dependency on that file to be included indirectly. ------------- PR: https://git.openjdk.java.net/jfx/pull/447