https://fedoraproject.org/wiki/Format-Security-FAQ#What_is_-Wformat-security
tests.c: In function ‘test_minmea_check_fn’:
tests.c:79:9: error: format not a string literal and no format arguments [-Werror=format-security]
79 | ck_assert_msg(minmea_check(*sentence, false) == true, *sentence);
| ^~~~~~~~~~~~~
tests.c:80:9: error: format not a string literal and no format arguments [-Werror=format-security]
80 | ck_assert_msg(minmea_check(*sentence, true) == false, *sentence);
| ^~~~~~~~~~~~~
tests.c:84:9: error: format not a string literal and no format arguments [-Werror=format-security]
84 | ck_assert_msg(minmea_check(*sentence, false) == true, *sentence);
| ^~~~~~~~~~~~~
tests.c:85:9: error: format not a string literal and no format arguments [-Werror=format-security]
85 | ck_assert_msg(minmea_check(*sentence, true) == true, *sentence);
| ^~~~~~~~~~~~~
tests.c:89:9: error: format not a string literal and no format arguments [-Werror=format-security]
89 | ck_assert_msg(minmea_check(*sentence, false) == false, *sentence);
| ^~~~~~~~~~~~~
tests.c:90:9: error: format not a string literal and no format arguments [-Werror=format-security]
90 | ck_assert_msg(minmea_check(*sentence, true) == false, *sentence);
| ^~~~~~~~~~~~~
* Fix padding problem in test_minmea_parse_gll1
* Add support for $--VTG sentences.
* Add tests for $--VTG sentences.
* Fix padding problem in test_minmea_parse_gll1. 2nd attempt.
Instead of comparing floats "x == y", perform comparison
"fabs(x - y) <= epsilon", where epsilon is acceptable error that
accumulates in computation of x and/or y.
Because in this case all integers are small and all floats are exactly
representable under IEEE754, epsilon may be zero in our tests.
This warning occurred when compiling using
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
on CentOS 6.5 x86_64
using the following CFLAGS (locally inserted into Makefile)
CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
-Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
-Waggregate-return -Wstrict-prototypes -Wold-style-declaration
-Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
-Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
-Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
-Wshadow -Wsign-compare -Wlogical-op -std=c99
and this make command:
make clean ; make example tests
This warning occurred when compiling using
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
on CentOS 6.5 x86_64
using the following CFLAGS (locally inserted into Makefile)
CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
-Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
-Waggregate-return -Wstrict-prototypes -Wold-style-declaration
-Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
-Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
-Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
-Wshadow -Wsign-compare -Wlogical-op -std=c99
and this make command:
make clean ; make example tests
This warning occurred when compiling using
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
on CentOS 6.5 x86_64
using the following CFLAGS (locally inserted into Makefile)
CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
-Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
-Waggregate-return -Wstrict-prototypes -Wold-style-declaration
-Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
-Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
-Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
-Wshadow -Wsign-compare -Wlogical-op -std=c99
and this make command:
make clean ; make example tests
This warning occurred when compiling using
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
on CentOS 6.5 x86_64
using the following CFLAGS (locally inserted into Makefile)
CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
-Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
-Waggregate-return -Wstrict-prototypes -Wold-style-declaration
-Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
-Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
-Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
-Wshadow -Wsign-compare -Wlogical-op -std=c99
and this make command:
make clean ; make example tests
This is an API breaker that incorporates the following big changes:
1. The (value, scale) float, as used in minmea, is a compound type. It
should be declared and used as such.
2. Some platforms, notably avr-gcc, have 16-bit ints. Make life easier
for them by using int_least32_t for floating point values.
3. As a side effect, the following functions were renamed:
* minmea_coord -> minmea_tocoord
* minmea_float -> minmea_tofloat
Migration guide for user code (easy unless you do fancy stuff):
1. Replace calls to minmea_{coord,float}.
2. Replace int32_t with int_least32_t in user code if your platform
requires this.
This is a backwards-incompatible change that I knew I'd have to
introduce sooner or later. Which means now.
Long story short: when I first started writing this library, I wanted to
make things simpler by treating the entire talker+sentence as one big
ID. Of course, this is an oversimplification, as there are different
talkers out there.
Turns out they're more common than I initially thought. I just came
across a module (read: I had one soldered to my board by our crazy
hardware guy) that spits out GPRMC, GLRMC or GNRMC depending on where it
got the data. I could have kludged around this, but here's this change,
for the purity of code.
Fortunately, we're the only users of this codebase as far as I know, so
no real harm is done - but it's a lesson to design my interfaces right
from the very start so I don't have to break compatibility and write
apologetic messages later on.