Jan Kundrát
2018-11-09 18:55:04 UTC
Hi,
GCC 7.x introduced additional build-time checks for functions such as
sprintf. The compiler now warns if it sees a possibility of a buffer
overflow or truncation. I'm building linphone on a desktop Linux with GCC
8.1, and because the build (of at least some packages) enforces -Werror, I
was getting build failures.
(Please consider removing -Werror, it breaks the build for your future
users.)
Switching to snprintf() did not help; apparently the compiler still
considers truncation as an error.
It was necessary to use modulo arithmetics so that the compiler can infer
that it's just, e.g., four digits per year. After that the numbers still
wouldn't fit because the compiler wasn't sure that they are positive --
hence the static_cast<unsigned>.
In vo-amrwbenc I simply removed the __unused stanza. It looks like a
non-standard way of silencing a warning about an unused variable. I don't
know C and I do not know which C standard you're targetting (and the
situation with __attribute__(unused) is not standard AFAIU), so I simply
removed that declaration -- the build succeeded after that.
Can you please ensure that these patches eventually reach the respective
projects' upstreams? I see that you're distributing a fork which is based
on an older version, at least with SOCI.
Thanks for your SW, btw.
Cheers,
Jan
GCC 7.x introduced additional build-time checks for functions such as
sprintf. The compiler now warns if it sees a possibility of a buffer
overflow or truncation. I'm building linphone on a desktop Linux with GCC
8.1, and because the build (of at least some packages) enforces -Werror, I
was getting build failures.
(Please consider removing -Werror, it breaks the build for your future
users.)
Switching to snprintf() did not help; apparently the compiler still
considers truncation as an error.
It was necessary to use modulo arithmetics so that the compiler can infer
that it's just, e.g., four digits per year. After that the numbers still
wouldn't fit because the compiler wasn't sure that they are positive --
hence the static_cast<unsigned>.
In vo-amrwbenc I simply removed the __unused stanza. It looks like a
non-standard way of silencing a warning about an unused variable. I don't
know C and I do not know which C standard you're targetting (and the
situation with __attribute__(unused) is not standard AFAIU), so I simply
removed that declaration -- the build succeeded after that.
Can you please ensure that these patches eventually reach the respective
projects' upstreams? I see that you're distributing a fork which is based
on an older version, at least with SOCI.
Thanks for your SW, btw.
Cheers,
Jan