Skip to content

Commit bafac07

Browse files
swiftnav-svc-jenkinsjungleraptor
authored andcommitted
open source publish d943f30..8d82edd
X-Publish-Start-Commit: d943f30 X-Publish-Start-Commit: 8d82edd --- Remove the GROUP_META_N_GROUP_MSGS and define it locally in Starling instead Author: Isak Tjernberg <[email protected]> --- Add comparators Author: laykuan loh <[email protected]> --- Merge cherry-picks from refs/heads/starling-v1.2.20-release into master: Added an enum value for no geoid model * Empty commit to allow PR creation * Add enum for geoid model * Added an enum value for no geoid model Co-authored-by: Christian Reimer <[email protected]> Co-authored-by: Joseph Angelo <[email protected]> --- Corrected the reported geoid model version Author: Joseph Angelo <[email protected]> --- Added additional helpful operators for gps_time_t Author: Joseph Angelo <[email protected]> --- Explicitly made bitmask a 64-bit value Co-authored-by: Joseph Angelo <[email protected]> --- Add utc2gps and other missing time conversions Author: Joseph Angelo <[email protected]> --- Portability project Author: Matt Woodward <[email protected]> --- Add missing header files so that they get installed by the cmake install rule added macro_overload.h but missed 6 other header files, e.g. bitstream.h which is used by librtcm Author: dgburr <[email protected]> --- sub_constellation_to_constellation Author: Alex Kleeman <[email protected]> --- Use new clang-tidy module Author: Matt Woodward <[email protected]> --- Fix indexing issues in clock_map by passing in only supported signals * throw out unused signals * Address review comments Author: laykuan loh <[email protected]> --- Fix incorrect pointer dereferencing * Fix incorrect pointer dereferencing * Add unit test for PIKSI-191 assert * Maybe fix clang-tidy error Co-authored-by: Isak Tjernberg <[email protected]> Co-authored-by: Matt Woodward <[email protected]> --- Fix for spurious maybe-uninitialised warning on GCC 11 Author: Christian Reimer <[email protected]> --- more fixes for building with GCC 11 * Add GCC 11 target to CI * Fixes warnings around potentially uninitialized arrays that occur with GCC 11 when utilizing matrix related functions Author: Jason Mobarak <[email protected]> ---
1 parent c580b9d commit bafac07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1215
-625
lines changed

.clang-tidy

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
include:
7474
- {os: ubuntu-18.04, cc: "gcc-6", cxx: "g++-6", test_suite: "unit"}
7575
- {os: ubuntu-18.04, cc: "clang-6.0", cxx: "clang++-6.0", test_suite: "lint"}
76+
- {os: ubuntu-18.04, cc: "gcc-11", cxx: "g++-11", test_suite: "unit"}
7677
- {os: macos-10.15, cc: "clang", cxx: "clang++", test_suite: "unit"}
7778

7879
runs-on: ${{ matrix.os }}
@@ -98,6 +99,11 @@ jobs:
9899
run: |
99100
sudo apt-get install -y gcc-6 g++-6
100101
102+
- name: Install gcc-11 (Linux)
103+
if: matrix.os == 'ubuntu-18.04' && matrix.cc == 'gcc-11'
104+
run: |
105+
sudo apt-get install -y gcc-11 g++-11
106+
101107
- name: Install clang-6.0 (Linux)
102108
if: matrix.os == 'ubuntu-18.04' && matrix.cc == 'clang-6.0'
103109
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
build*
22
include/swiftnav/config.h
33
*.swp
4+
.clang-tidy
45

56
# IDE files
67
.vscode/

CMakeLists.txt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 3.3)
22
project(libswiftnav)
33

44
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/" "${CMAKE_CURRENT_LIST_DIR}/cmake/common")
@@ -29,16 +29,20 @@ swift_create_project_options(
2929
include(ClangFormat)
3030
swift_setup_clang_format()
3131
include(ClangTidy)
32-
swift_setup_clang_tidy(PATTERNS "src/*.c")
3332
include(CodeCoverage)
3433
add_code_coverage_all_targets()
34+
include(CheckAttributes)
35+
create_check_attributes_target(EXCLUDE "include/swiftnav/macros.h")
36+
include(SwiftTargets)
3537

3638
option(LIBSWIFTNAV_ENABLE_STDERR_LOGGING "Enable logging to stderr by default" ON)
3739

3840
set(HDRS
3941
include/swiftnav/almanac.h
4042
include/swiftnav/array_tools.h
4143
include/swiftnav/bits.h
44+
include/swiftnav/bitstream.h
45+
include/swiftnav/bytestream.h
4246
include/swiftnav/ch_meas.h
4347
include/swiftnav/common.h
4448
include/swiftnav/constants.h
@@ -48,14 +52,17 @@ set(HDRS
4852
include/swiftnav/edc.h
4953
include/swiftnav/ephemeris.h
5054
include/swiftnav/fifo_byte.h
55+
include/swiftnav/float_equality.h
5156
include/swiftnav/geoid_model.h
5257
include/swiftnav/glo_map.h
5358
include/swiftnav/glonass_phase_biases.h
59+
include/swiftnav/gnss_capabilities.h
5460
include/swiftnav/gnss_time.h
5561
include/swiftnav/ionosphere.h
5662
include/swiftnav/linear_algebra.h
5763
include/swiftnav/logging.h
5864
include/swiftnav/macro_overload.h
65+
include/swiftnav/macros.h
5966
include/swiftnav/memcpy_s.h
6067
include/swiftnav/nav_meas.h
6168
include/swiftnav/pvt_result.h
@@ -65,6 +72,7 @@ set(HDRS
6572
include/swiftnav/sid_set.h
6673
include/swiftnav/signal.h
6774
include/swiftnav/single_epoch_solver.h
75+
include/swiftnav/swift_strnlen.h
6876
include/swiftnav/troposphere.h)
6977

7078
set(SRCS
@@ -93,11 +101,11 @@ set(SRCS
93101
src/single_epoch_solver.c
94102
src/troposphere.c)
95103

96-
add_library(swiftnav ${HDRS} ${SRCS})
97-
swift_set_language_standards(swiftnav)
98-
swift_set_compile_options(swiftnav ADD -pedantic REMOVE -Wconversion -Wstack-protector)
99-
100-
target_code_coverage(swiftnav AUTO ALL)
104+
swift_add_library(swiftnav
105+
SOURCES ${HDRS} ${SRCS}
106+
REMOVE_COMPILE_OPTIONS -Wconversion -Wstack-protector
107+
)
108+
add_library(swiftnav::swiftnav ALIAS swiftnav)
101109
target_include_directories(swiftnav PUBLIC ${PROJECT_SOURCE_DIR}/include)
102110
target_include_directories(swiftnav PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
103111
if(LIBSWIFTNAV_ENABLE_STDERR_LOGGING)
@@ -106,10 +114,6 @@ endif()
106114

107115
target_compile_options(swiftnav PRIVATE "-UNDEBUG")
108116

109-
target_code_coverage(swiftnav AUTO ALL)
110-
target_include_directories(swiftnav PUBLIC ${PROJECT_SOURCE_DIR}/include)
111-
target_include_directories(swiftnav PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
112-
113117
if (MSVC)
114118
else ()
115119
target_link_libraries(swiftnav PRIVATE m)
@@ -122,3 +126,6 @@ install(TARGETS swiftnav DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
122126
if(libswiftnav_BUILD_TESTS OR libswiftnav_BUILD_TEST_LIBS)
123127
add_subdirectory(tests)
124128
endif()
129+
130+
swift_validate_targets()
131+
swift_create_clang_tidy_targets()

include/swiftnav/almanac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ typedef struct {
126126
almanac_kepler_t kepler; /**< Parameters specific to GPS. */
127127
almanac_xyz_t xyz; /**< Parameters specific to SBAS. */
128128
almanac_glo_t glo; /**< Parameters specific to GLONASS. */
129-
};
129+
} data;
130130
} almanac_t;
131131

132132
/**

include/swiftnav/bitstream.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static inline bool swiftnav_bitstream_getbitu(const swiftnav_bitstream_t *buf,
3838
if (swiftnav_bitstream_would_overflow(buf, pos, len)) {
3939
return false;
4040
}
41-
*out = getbitu(buf->data, buf->offset + pos, len);
41+
*out = getbitu(buf->data, buf->offset + pos, (u8)len);
4242
return true;
4343
}
4444

@@ -49,7 +49,7 @@ static inline bool swiftnav_bitstream_getbits(const swiftnav_bitstream_t *buf,
4949
if (swiftnav_bitstream_would_overflow(buf, pos, len)) {
5050
return false;
5151
}
52-
*out = getbits(buf->data, buf->offset + pos, len);
52+
*out = getbits(buf->data, buf->offset + pos, (u8)len);
5353
return true;
5454
}
5555

@@ -60,7 +60,7 @@ static inline bool swiftnav_bitstream_getbitul(const swiftnav_bitstream_t *buf,
6060
if (swiftnav_bitstream_would_overflow(buf, pos, len)) {
6161
return false;
6262
}
63-
*out = getbitul(buf->data, buf->offset + pos, len);
63+
*out = getbitul(buf->data, buf->offset + pos, (u8)len);
6464
return true;
6565
}
6666

@@ -71,7 +71,7 @@ static inline bool swiftnav_bitstream_getbitsl(const swiftnav_bitstream_t *buf,
7171
if (swiftnav_bitstream_would_overflow(buf, pos, len)) {
7272
return false;
7373
}
74-
*out = getbitsl(buf->data, buf->offset + pos, len);
74+
*out = getbitsl(buf->data, buf->offset + pos, (u8)len);
7575
return true;
7676
}
7777

include/swiftnav/common.h

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,26 @@
1717
#include <limits.h>
1818
#include <stdint.h>
1919

20-
#ifdef LSN_USE_HEAP
21-
#include <stdlib.h>
22-
#define LSN_ALLOCATE(size) malloc(size)
23-
#define LSN_FREE(ptr) free((void *)ptr)
24-
#else /* LSN_USE_HEAP */
2520
#ifdef _MSC_VER
2621
#include <malloc.h>
27-
#define LSN_ALLOCATE(size) _malloca(size)
28-
#else /* _MSC_VER */
29-
#ifdef __GLIBC__
30-
#include <alloca.h> /* glibc has an alloca specific header */
31-
#else /* __GLIBC__ */
32-
#include <stdlib.h>
33-
#endif /* __GLIBC__ */
34-
#define LSN_ALLOCATE(size) alloca(size)
35-
#endif /* _MSC_VER */
36-
#define LSN_FREE(ptr)
37-
#endif /* LSN_USE_HEAP */
22+
#define LSN_NEW_ARRAY(Name, ItemCount, Type) \
23+
Type *Name = _malloca(sizeof(Type) * (ItemCount)); \
24+
assert(Name != NULL); \
25+
memset(Name, 0, sizeof(Type) * (ItemCount))
26+
#define LSN_FREE_ARRAY(ptr) _freea((void *)ptr)
27+
#else
28+
#define LSN_NEW_ARRAY(Name, ItemCount, Type) \
29+
Type Name[ItemCount]; \
30+
for (size_t _x_##Name = 0; _x_##Name < (ItemCount); _x_##Name++) { \
31+
(Name)[_x_##Name] = 0; \
32+
}
33+
#define LSN_FREE_ARRAY(ptr)
34+
#endif
3835

3936
#ifdef __cplusplus
4037
extern "C" {
4138
#endif
4239

43-
#if defined(_MSC_VER)
44-
#if !defined(_WINDLL)
45-
/* Leave empty when doing non-dll build */
46-
#define LIBSWIFTNAV_DECLSPEC
47-
#elif defined(swiftnav_EXPORTS) /* swiftnav_EXTENSION */
48-
#define LIBSWIFTNAV_DECLSPEC __declspec(dllexport)
49-
#else /* swiftnav_EXPORTS */
50-
#define LIBSWIFTNAV_DECLSPEC __declspec(dllimport)
51-
#endif /* swiftnav_EXPORTS */
52-
#elif defined(__GNUC__) /* _MSC_VER */
53-
#define LIBSWIFTNAV_DECLSPEC __attribute__((visibility("default")))
54-
#else /* __GNUC__ */
55-
#pragma error Unknown dynamic link import / export semantics.
56-
#endif /* __GNUC__ */
57-
5840
/** \defgroup common Common definitions
5941
* Common definitions used throughout the library.
6042
* \{ */

include/swiftnav/constants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ extern "C" {
3131
#define M_PI_2 1.5707963267948966192313216
3232
#endif
3333

34+
#ifndef M_SQRT2
35+
#define M_SQRT2 1.41421356237309504880
36+
#endif
37+
3438
#define R2D (180.0 / M_PI) /**< Conversion factor from radians to degrees. */
3539
#define D2R (M_PI / 180.0) /**< Conversion factor from degrees to radians. */
3640
#define AS2R (D2R / 3600.0)

include/swiftnav/ephemeris.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ typedef struct {
282282
ephemeris_kepler_t kepler; /**< Parameters specific to GPS. */
283283
ephemeris_xyz_t xyz; /**< Parameters specific to SBAS. */
284284
ephemeris_glo_t glo; /**< Parameters specific to GLONASS. */
285-
};
285+
} data;
286286
} ephemeris_t;
287287

288288
#define GLO_NAV_STR_BITS 85 /**< Length of GLO navigation string */

0 commit comments

Comments
 (0)