Merge pull request #4 from mek-x/fix_gcc
Fixing compilation and tests for GCC on Linux
This commit is contained in:
commit
b5b080cdaf
2
Makefile
2
Makefile
@ -4,7 +4,7 @@
|
|||||||
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
|
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
|
||||||
# published by Sam Hocevar. See the COPYING file for more details.
|
# published by Sam Hocevar. See the COPYING file for more details.
|
||||||
|
|
||||||
CFLAGS = -g -Wall -Wextra -Werror
|
CFLAGS = -g -Wall -Wextra -Werror -std=c99
|
||||||
LDFLAGS = -lcheck
|
LDFLAGS = -lcheck
|
||||||
|
|
||||||
all: scan-build test example
|
all: scan-build test example
|
||||||
|
2
minmea.h
2
minmea.h
@ -9,6 +9,8 @@
|
|||||||
#ifndef MINMEA_H
|
#ifndef MINMEA_H
|
||||||
#define MINMEA_H
|
#define MINMEA_H
|
||||||
|
|
||||||
|
#define _BSD_SOURCE
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
10
tests.c
10
tests.c
@ -6,6 +6,8 @@
|
|||||||
* published by Sam Hocevar. See the COPYING file for more details.
|
* published by Sam Hocevar. See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -353,7 +355,7 @@ START_TEST(test_minmea_parse_rmc1)
|
|||||||
{
|
{
|
||||||
const char *sentence = "$GPRMC,081836.75,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E";
|
const char *sentence = "$GPRMC,081836.75,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E";
|
||||||
struct minmea_sentence_rmc frame = {};
|
struct minmea_sentence_rmc frame = {};
|
||||||
struct minmea_sentence_rmc expected = {
|
static const struct minmea_sentence_rmc expected = {
|
||||||
.time = { 8, 18, 36, 750000 },
|
.time = { 8, 18, 36, 750000 },
|
||||||
.valid = true,
|
.valid = true,
|
||||||
.latitude = -375165,
|
.latitude = -375165,
|
||||||
@ -378,7 +380,7 @@ START_TEST(test_minmea_parse_rmc2)
|
|||||||
{
|
{
|
||||||
const char *sentence = "$GPRMC,,A,3751.65,N,14507.36,W,,,,,";
|
const char *sentence = "$GPRMC,,A,3751.65,N,14507.36,W,,,,,";
|
||||||
struct minmea_sentence_rmc frame = {};
|
struct minmea_sentence_rmc frame = {};
|
||||||
struct minmea_sentence_rmc expected = {
|
static const struct minmea_sentence_rmc expected = {
|
||||||
.time = { -1, -1, -1, -1 },
|
.time = { -1, -1, -1, -1 },
|
||||||
.valid = true,
|
.valid = true,
|
||||||
.latitude = 375165,
|
.latitude = 375165,
|
||||||
@ -397,7 +399,7 @@ START_TEST(test_minmea_parse_gga1)
|
|||||||
{
|
{
|
||||||
const char *sentence = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47";
|
const char *sentence = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47";
|
||||||
struct minmea_sentence_gga frame = {};
|
struct minmea_sentence_gga frame = {};
|
||||||
struct minmea_sentence_gga expected = {
|
static const struct minmea_sentence_gga expected = {
|
||||||
.time = { 12, 35, 19, 0 },
|
.time = { 12, 35, 19, 0 },
|
||||||
.latitude = 4807038,
|
.latitude = 4807038,
|
||||||
.latitude_scale = 1000,
|
.latitude_scale = 1000,
|
||||||
@ -425,7 +427,7 @@ START_TEST(test_minmea_parse_gsa1)
|
|||||||
{
|
{
|
||||||
const char *sentence = "$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39";
|
const char *sentence = "$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39";
|
||||||
struct minmea_sentence_gsa frame = {};
|
struct minmea_sentence_gsa frame = {};
|
||||||
struct minmea_sentence_gsa expected = {
|
static const struct minmea_sentence_gsa expected = {
|
||||||
.mode = MINMEA_GPGSA_MODE_AUTO,
|
.mode = MINMEA_GPGSA_MODE_AUTO,
|
||||||
.fix_type = MINMEA_GPGSA_FIX_3D,
|
.fix_type = MINMEA_GPGSA_FIX_3D,
|
||||||
.sats = { 4, 5, 0, 9, 12, 0, 0, 24, 0, 0, 0, 0 },
|
.sats = { 4, 5, 0, 9, 12, 0, 0, 24, 0, 0, 0, 0 },
|
||||||
|
Loading…
Reference in New Issue
Block a user