Merge pull request #4 from mek-x/fix_gcc

Fixing compilation and tests for GCC on Linux
This commit is contained in:
Kosma Moczek 2014-04-24 11:32:20 +02:00
commit b5b080cdaf
3 changed files with 9 additions and 5 deletions

View File

@ -4,7 +4,7 @@
# 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.
CFLAGS = -g -Wall -Wextra -Werror
CFLAGS = -g -Wall -Wextra -Werror -std=c99
LDFLAGS = -lcheck
all: scan-build test example

View File

@ -9,6 +9,8 @@
#ifndef MINMEA_H
#define MINMEA_H
#define _BSD_SOURCE
#ifdef __cplusplus
extern "C" {
#endif

10
tests.c
View File

@ -6,6 +6,8 @@
* published by Sam Hocevar. See the COPYING file for more details.
*/
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#include <stdlib.h>
#include <string.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";
struct minmea_sentence_rmc frame = {};
struct minmea_sentence_rmc expected = {
static const struct minmea_sentence_rmc expected = {
.time = { 8, 18, 36, 750000 },
.valid = true,
.latitude = -375165,
@ -378,7 +380,7 @@ START_TEST(test_minmea_parse_rmc2)
{
const char *sentence = "$GPRMC,,A,3751.65,N,14507.36,W,,,,,";
struct minmea_sentence_rmc frame = {};
struct minmea_sentence_rmc expected = {
static const struct minmea_sentence_rmc expected = {
.time = { -1, -1, -1, -1 },
.valid = true,
.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";
struct minmea_sentence_gga frame = {};
struct minmea_sentence_gga expected = {
static const struct minmea_sentence_gga expected = {
.time = { 12, 35, 19, 0 },
.latitude = 4807038,
.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";
struct minmea_sentence_gsa frame = {};
struct minmea_sentence_gsa expected = {
static const struct minmea_sentence_gsa expected = {
.mode = MINMEA_GPGSA_MODE_AUTO,
.fix_type = MINMEA_GPGSA_FIX_3D,
.sats = { 4, 5, 0, 9, 12, 0, 0, 24, 0, 0, 0, 0 },