1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-19 05:33:02 +00:00

Merge branch 'next' of github.com:gnss-sdr/gnss-sdr into pps_lime

This commit is contained in:
Javier Arribas 2021-11-29 20:54:56 +01:00
commit c262d74e03
29 changed files with 687 additions and 107 deletions

View File

@ -611,13 +611,38 @@ endif()
################################################################################ ################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/ # Log4cpp - http://log4cpp.sourceforge.net/
################################################################################ ################################################################################
find_package(LOG4CPP) if(GNURADIO_USES_LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio." PURPOSE "Required by GNU Radio."
TYPE REQUIRED TYPE REQUIRED
) )
if(NOT LOG4CPP_FOUND) endif()
message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
################################################################################
# spdlog - https://github.com/gabime/spdlog
################################################################################
if(GNURADIO_USES_SPDLOG)
find_package(SPDLOG REQUIRED)
set_package_properties(SPDLOG PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################
# fmt - https://github.com/fmtlib/fmt
################################################################################
if(GNURADIO_USES_SPDLOG)
find_package(FMT REQUIRED)
set_package_properties(FMT PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif() endif()
@ -632,7 +657,7 @@ if(NOT ENABLE_OWN_GPSTK)
PURPOSE "Used in some Extra Tests." PURPOSE "Used in some Extra Tests."
) )
endif() endif()
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17) if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND (LOG4CPP_READY_FOR_CXX17 OR GNURADIO_USES_SPDLOG))
# Check if we have std::filesystem # Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8)) if(NOT (CMAKE_VERSION VERSION_LESS 3.8))
if(NOT GPSTK_FOUND OR NOT (GPSTK_FOUND AND GPSTK_OLDER_THAN_8)) # Fix for GPSTk < 8.0.0 if(NOT GPSTK_FOUND OR NOT (GPSTK_FOUND AND GPSTK_OLDER_THAN_8)) # Fix for GPSTk < 8.0.0
@ -668,6 +693,7 @@ if((NOT PMT_USES_BOOST_ANY) AND (CMAKE_CXX_STANDARD VERSION_LESS 17))
endif() endif()
################################################################################ ################################################################################
# Boost - https://www.boost.org # Boost - https://www.boost.org
################################################################################ ################################################################################
@ -685,7 +711,9 @@ set(Boost_ADDITIONAL_VERSIONS
"1.70.0" "1.70" "1.71.0" "1.71" "1.70.0" "1.70" "1.71.0" "1.71"
) )
set(Boost_USE_MULTITHREAD ON) set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF) #set(Boost_USE_STATIC_LIBS OFF)
option(Boost_USE_STATIC_LIBS "Use Boost static libs" OFF)
set(BOOST_COMPONENTS atomic chrono date_time serialization system thread) set(BOOST_COMPONENTS atomic chrono date_time serialization system thread)
if(NOT ${FILESYSTEM_FOUND}) if(NOT ${FILESYSTEM_FOUND})
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem) set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem)

View File

@ -0,0 +1,76 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Locate header
find_path(FMT_INCLUDE_DIR fmt/core.h
HINTS ${FMT_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
# Locate library
find_library(FMT_LIBRARY NAMES fmt
HINTS ${FMT_ROOT_DIR}/lib ${FMT_ROOT_DIR}/lib64
PATHS
/usr/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/local/lib
/usr/local/lib64
/opt/local/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FMT DEFAULT_MSG FMT_INCLUDE_DIR FMT_LIBRARY)
set_package_properties(FMT PROPERTIES
URL "https://github.com/fmtlib/fmt"
DESCRIPTION "An open-source formatting library"
)
# Add imported target.
if(FMT_FOUND)
set(FMT_INCLUDE_DIRS "${FMT_INCLUDE_DIR}")
if(NOT TARGET fmt::fmt)
add_library(fmt::fmt UNKNOWN IMPORTED)
set_target_properties(fmt::fmt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIRS}"
)
set_property(TARGET fmt::fmt APPEND PROPERTY
IMPORTED_LOCATION "${FMT_LIBRARY}"
)
endif()
endif()

View File

@ -392,6 +392,30 @@ if(GNURADIO_PMT_INCLUDE_DIRS)
endif() endif()
endif() endif()
# Check if GNU Radio uses log4cpp or spdlog
if(GNURADIO_RUNTIME_INCLUDE_DIRS)
if(EXISTS "${GNURADIO_RUNTIME_INCLUDE_DIRS}/gnuradio/logger.h")
file(STRINGS ${GNURADIO_RUNTIME_INCLUDE_DIRS}/gnuradio/logger.h _logger_content)
set(_uses_log4cpp FALSE)
set(_uses_spdlog FALSE)
foreach(_loop_var IN LISTS _logger_content)
string(STRIP "${_loop_var}" _file_line)
if("#include <log4cpp/Category.hh>" STREQUAL "${_file_line}")
set(_uses_log4cpp TRUE)
endif()
if("#include <spdlog/common.h>" STREQUAL "${_file_line}")
set(_uses_spdlog TRUE)
endif()
endforeach()
if(${_uses_log4cpp})
set(GNURADIO_USES_LOG4CPP TRUE)
endif()
if(${_uses_spdlog})
set(GNURADIO_USES_SPDLOG TRUE)
endif()
endif()
endif()
set_package_properties(GNURADIO PROPERTIES set_package_properties(GNURADIO PROPERTIES
URL "https://www.gnuradio.org/" URL "https://www.gnuradio.org/"
) )

View File

@ -0,0 +1,84 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Locate header
find_path(SPDLOG_INCLUDE_DIR spdlog/spdlog.h
HINTS ${SPDLOG_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
# Locate library
find_library(SPDLOG_LIBRARY NAMES spdlog spdlogd
HINTS ${SPDLOG_ROOT_DIR}/lib ${SPDLOG_ROOT_DIR}/lib64
PATHS
/usr/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/local/lib
/usr/local/lib64
/opt/local/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPDLOG DEFAULT_MSG SPDLOG_INCLUDE_DIR SPDLOG_LIBRARY)
set_package_properties(SPDLOG PROPERTIES
URL "https://github.com/gabime/spdlog"
DESCRIPTION "Very fast, header-only/compiled, C++ logging library"
)
# Add imported target.
if(SPDLOG_FOUND)
set(SPDLOG_INCLUDE_DIRS "${SPDLOG_INCLUDE_DIR}")
if(NOT TARGET spdlog::spdlog)
add_library(spdlog::spdlog UNKNOWN IMPORTED)
set_target_properties(spdlog::spdlog PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIRS}"
)
set_property(TARGET spdlog::spdlog APPEND PROPERTY
IMPORTED_LOCATION "${SPDLOG_LIBRARY}"
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.11.0)
target_compile_definitions(spdlog::spdlog INTERFACE -DSPDLOG_FMT_EXTERNAL=1)
else()
set_property(TARGET spdlog::spdlog APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS SPDLOG_FMT_EXTERNAL=1
)
endif()
endif()

View File

@ -19,6 +19,8 @@ All notable changes to GNSS-SDR will be documented in this file.
- Improved Time-To-First-Fix when using GPS L1 C/A signals, fixing a bug that - Improved Time-To-First-Fix when using GPS L1 C/A signals, fixing a bug that
was making the receiver to drop the satellite if the PLL got locked at 180 was making the receiver to drop the satellite if the PLL got locked at 180
degrees, and making some optimizations on bit transition detection. degrees, and making some optimizations on bit transition detection.
- Fixed a bug that prevented from obtaining PVT fixes with Galileo E1 OS signals
if the I/NAV subframe type 0 was the first decoded subframe.
### Improvements in Interoperability: ### Improvements in Interoperability:
@ -38,8 +40,8 @@ All notable changes to GNSS-SDR will be documented in this file.
for easier detection of unused data members (see for easier detection of unused data members (see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md/#Rc-initialize). https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md/#Rc-initialize).
- Non-functional change: Fixed formatting defects detected by clang-format 13.0. - Non-functional change: Fixed formatting defects detected by clang-format 13.0.
- Updated GSL implementation to v0.39.0. See - Updated GSL implementation to v0.40.0. See
https://github.com/gsl-lite/gsl-lite/releases/tag/v0.39.0 https://github.com/gsl-lite/gsl-lite/releases/tag/v0.40.0
- CI - `cpplint` job on GitHub: Added the `build/include_what_you_use` filter - CI - `cpplint` job on GitHub: Added the `build/include_what_you_use` filter
for early detection of missing includes. for early detection of missing includes.
- CI - `clang-tidy` job on GitHub: More robust detection of LLVM paths installed - CI - `clang-tidy` job on GitHub: More robust detection of LLVM paths installed
@ -48,14 +50,22 @@ All notable changes to GNSS-SDR will be documented in this file.
### Improvements in Portability: ### Improvements in Portability:
- Fixed building against the new API in the gr-iio component present in GNU - Fixed building against the new API in the gr-iio component present in GNU
Radio's `master` branch (currently v3.10.0.git). Radio v3.10.0.0-rc1.
- Fixed building against current GNU Radio's `master` branch, which does not - Fixed building against GNU Radio v3.10.0.0-rc1, which does not support the
support the C++20 standard. C++20 standard.
- Fixed building against GNU Radio v3.10.0.0-rc1, which replaced
[log4cpp](http://log4cpp.sourceforge.net/) by
[spdlog](https://github.com/gabime/spdlog) and
[fmt](https://github.com/fmtlib/fmt) libraries.
- Updated `cpu_features` library for improved processor detection. - Updated `cpu_features` library for improved processor detection.
### Improvements in Reliability: ### Improvements in Reliability:
- Fixed some potential buffer overflows. - Fixed some potential buffer overflows.
- Avoid source code lines longer than 512 characters. This was a warning raised
by Lintian (very-long-line-length-in-source-file). Long lines in source code
could be used to obfuscate the source code and to hide stuff like backdoors or
security problems.
### Improvements in Usability: ### Improvements in Usability:

View File

@ -39,6 +39,14 @@ if(USE_OLD_BOOST_MATH_COMMON_FACTOR)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(pvt_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_CLANG_TIDY) if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE) if(CLANG_TIDY_EXE)
set_target_properties(pvt_adapters set_target_properties(pvt_adapters

View File

@ -76,6 +76,10 @@ else()
) )
endif() endif()
if(CMAKE_ANDROID_ARCH_ABI)
target_compile_definitions(pvt_libs PUBLIC -DANDROID=1)
endif()
target_link_libraries(pvt_libs target_link_libraries(pvt_libs
PUBLIC PUBLIC
Boost::date_time Boost::date_time

View File

@ -1511,6 +1511,9 @@ std::string Rinex_Printer::getLocalTime() const
line += std::string("GNSS-SDR"); line += std::string("GNSS-SDR");
line += std::string(12, ' '); line += std::string(12, ' ');
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
@ -1521,6 +1524,8 @@ std::string Rinex_Printer::getLocalTime() const
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += Rinex_Printer::leftJustify(username, 20); line += Rinex_Printer::leftJustify(username, 20);
const boost::gregorian::date today = boost::gregorian::day_clock::local_day(); const boost::gregorian::date today = boost::gregorian::day_clock::local_day();
@ -3527,8 +3532,11 @@ void Rinex_Printer::rinex_sbs_header(std::fstream& out) const
line.clear(); line.clear();
line += Rinex_Printer::leftJustify("GNSS-SDR", 20); line += Rinex_Printer::leftJustify("GNSS-SDR", 20);
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -3537,6 +3545,7 @@ void Rinex_Printer::rinex_sbs_header(std::fstream& out) const
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += Rinex_Printer::leftJustify(username, 20); line += Rinex_Printer::leftJustify(username, 20);
// Date of file creation (dd-mmm-yy hhmm) // Date of file creation (dd-mmm-yy hhmm)
const boost::local_time::time_zone_ptr zone(new boost::local_time::posix_time_zone("UTC")); const boost::local_time::time_zone_ptr zone(new boost::local_time::posix_time_zone("UTC"));
@ -6001,8 +6010,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -6011,6 +6023,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -6327,8 +6340,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -6337,6 +6353,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -6682,8 +6699,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -6692,6 +6712,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -6991,8 +7012,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -7001,6 +7025,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -7314,8 +7339,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -7324,6 +7352,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -7571,8 +7600,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -7581,6 +7613,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -7822,8 +7855,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -7832,6 +7868,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -8103,8 +8140,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -8113,6 +8153,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -8449,8 +8490,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -8459,6 +8503,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -8767,8 +8812,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -8777,6 +8825,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -9034,8 +9083,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -9044,6 +9096,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);
@ -9316,8 +9369,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
#if ANDROID
username = "ANDROID USER";
#else
std::array<char, 20> c_username{}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1); const int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username.data(); username = c_username.data();
@ -9326,6 +9382,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme
{ {
username = "UNKNOWN USER"; username = "UNKNOWN USER";
} }
#endif
line += leftJustify(username, 20); line += leftJustify(username, 20);
line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property line += Rinex_Printer::leftJustify("CTTC", 40); // add flag and property
line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20); line += Rinex_Printer::leftJustify("OBSERVER / AGENCY", 20);

View File

@ -54,6 +54,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(channel_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_GENERIC_LAMBDAS) if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)

View File

@ -42,6 +42,14 @@ target_link_libraries(conditioner_adapters
Glog::glog Glog::glog
) )
if(GNURADIO_USES_SPDLOG)
target_link_libraries(conditioner_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(conditioner_adapters target_include_directories(conditioner_adapters
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/interfaces

View File

@ -55,6 +55,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(data_type_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
set_property(TARGET data_type_gr_blocks set_property(TARGET data_type_gr_blocks
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -46,9 +46,23 @@ target_link_libraries(input_filter_gr_blocks
algorithms_libs algorithms_libs
PRIVATE PRIVATE
Volk::volk Volk::volk
Log4cpp::log4cpp
) )
if(LOG4CPP_FOUND)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(input_filter_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(input_filter_gr_blocks target_include_directories(input_filter_gr_blocks
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/interfaces

View File

@ -120,6 +120,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(algorithms_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(FILESYSTEM_FOUND) if(FILESYSTEM_FOUND)
target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1) target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1)
if(find_experimental) if(find_experimental)

View File

@ -14,6 +14,7 @@
#define GSL_GSL_LITE_HPP_INCLUDED #define GSL_GSL_LITE_HPP_INCLUDED
#include <cstddef> // for size_t, ptrdiff_t, nullptr_t #include <cstddef> // for size_t, ptrdiff_t, nullptr_t
#include <cstdlib> // for abort()
#include <exception> // for exception, terminate(), uncaught_exceptions() #include <exception> // for exception, terminate(), uncaught_exceptions()
#include <ios> // for ios_base, streamsize #include <ios> // for ios_base, streamsize
#include <iosfwd> // for basic_ostream<> #include <iosfwd> // for basic_ostream<>
@ -24,7 +25,7 @@
#include <utility> // for move(), forward<>(), swap() #include <utility> // for move(), forward<>(), swap()
#define gsl_lite_MAJOR 0 #define gsl_lite_MAJOR 0
#define gsl_lite_MINOR 39 #define gsl_lite_MINOR 40
#define gsl_lite_PATCH 0 #define gsl_lite_PATCH 0
#define gsl_lite_VERSION gsl_STRINGIFY(gsl_lite_MAJOR) "." gsl_STRINGIFY(gsl_lite_MINOR) "." gsl_STRINGIFY(gsl_lite_PATCH) #define gsl_lite_VERSION gsl_STRINGIFY(gsl_lite_MAJOR) "." gsl_STRINGIFY(gsl_lite_MINOR) "." gsl_STRINGIFY(gsl_lite_PATCH)
@ -324,6 +325,21 @@
#pragma message("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_OFF) "; macro must be defined without value") #pragma message("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_OFF) "; macro must be defined without value")
#endif #endif
#endif #endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) #if defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) #if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_CONTRACT_VIOLATION_THROWS)
#pragma message("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_THROWS=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) "; macro must be defined without value") #pragma message("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_THROWS=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) "; macro must be defined without value")
@ -349,6 +365,21 @@
#pragma message("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER) "; macro must be defined without value") #pragma message("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER) "; macro must be defined without value")
#endif #endif
#endif #endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) #if defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) #if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME)
#pragma message("invalid configuration value gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME=" gsl_STRINGIFY(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) "; macro must be defined without value") #pragma message("invalid configuration value gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME=" gsl_STRINGIFY(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) "; macro must be defined without value")
@ -359,29 +390,83 @@
#pragma message("invalid configuration value gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE=" gsl_STRINGIFY(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE) "; macro must be defined without value") #pragma message("invalid configuration value gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE=" gsl_STRINGIFY(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE) "; macro must be defined without value")
#endif #endif
#endif #endif
#if defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE)
#if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE)
#pragma message("invalid configuration value gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE) "; macro must be defined without value")
#endif
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_THROWS)
#error cannot use gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_THROWS because exceptions are not supported in device code; use gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS or gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TERMINATES)
#error gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TERMINATES is not supported; use gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS or gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS
#endif
#if 1 < defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) + defined(gsl_CONFIG_CONTRACT_CHECKING_ON) + defined(gsl_CONFIG_CONTRACT_CHECKING_OFF) #if 1 < defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) + defined(gsl_CONFIG_CONTRACT_CHECKING_ON) + defined(gsl_CONFIG_CONTRACT_CHECKING_OFF)
#error only one of gsl_CONFIG_CONTRACT_CHECKING_AUDIT, gsl_CONFIG_CONTRACT_CHECKING_ON, and gsl_CONFIG_CONTRACT_CHECKING_OFF may be defined #error only one of gsl_CONFIG_CONTRACT_CHECKING_AUDIT, gsl_CONFIG_CONTRACT_CHECKING_ON, and gsl_CONFIG_CONTRACT_CHECKING_OFF may be defined
#endif #endif
#if 1 < defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT) + defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON) + defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF)
#error only one of gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT, gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON, and gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF may be defined
#endif
#if 1 < defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES) + defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER) #if 1 < defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES) + defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER)
#error only one of gsl_CONFIG_CONTRACT_VIOLATION_THROWS, gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES, gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS, gsl_CONFIG_CONTRACT_VIOLATION_TRAPS, and gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER may be defined #error only one of gsl_CONFIG_CONTRACT_VIOLATION_THROWS, gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES, gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS, gsl_CONFIG_CONTRACT_VIOLATION_TRAPS, and gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER may be defined
#endif #endif
#if 1 < defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS) + defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS) + defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER)
#error only one of gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS, gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS, and gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER may be defined
#endif
#if 1 < defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) + defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE) #if 1 < defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) + defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE)
#error only one of gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME and gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE may be defined #error only one of gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME and gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE may be defined
#endif #endif
#if 1 < defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME) + defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE)
#error only one of gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME and gsl_CONFIG_UNENFORCED_DEVICE_CONTRACTS_ELIDE may be defined
#endif
#if 0 == defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) + defined(gsl_CONFIG_CONTRACT_CHECKING_ON) + defined(gsl_CONFIG_CONTRACT_CHECKING_OFF) #if 0 == defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) + defined(gsl_CONFIG_CONTRACT_CHECKING_ON) + defined(gsl_CONFIG_CONTRACT_CHECKING_OFF)
// select default // select default
#define gsl_CONFIG_CONTRACT_CHECKING_ON #define gsl_CONFIG_CONTRACT_CHECKING_ON
#endif #endif
#if 0 == defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT) + defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON) + defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF)
// select default
#if defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT)
#define gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT
#elif defined(gsl_CONFIG_CONTRACT_CHECKING_OFF)
#define gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF
#else
#define gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON
#endif
#endif
#if 0 == defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES) + defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER) #if 0 == defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES) + defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS) + defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER)
// select default // select default
#define gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES #define gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES
#endif #endif
#if 0 == defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS) + defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS) + defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER)
// select default
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER)
#define gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER
#elif defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS)
#define gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS
#else
#define gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS
#endif
#endif
#if 0 == defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) + defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE) #if 0 == defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) + defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE)
// select default // select default
#define gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE #define gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE
#endif #endif
#if 0 == defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME) + defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE)
// select default
#if defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME)
#define gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME
#else
#define gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE
#endif
#endif
// C++ language version detection (C++20 is speculative): // C++ language version detection (C++20 is speculative):
// Note: VC14.0/1900 (VS2015) lacks too much from C++14. // Note: VC14.0/1900 (VS2015) lacks too much from C++14.
@ -527,6 +612,15 @@
#endif #endif
#define gsl_HAVE_WCHAR_() gsl_HAVE_WCHAR #define gsl_HAVE_WCHAR_() gsl_HAVE_WCHAR
// Compiling device code:
#if defined(__CUDACC__) && defined(__CUDA_ARCH__)
#define gsl_DEVICE_CODE 1
#else
#define gsl_DEVICE_CODE 0
#endif
// Presence of language & library features: // Presence of language & library features:
#if gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION #if gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION
@ -1036,7 +1130,7 @@
#include <initializer_list> #include <initializer_list>
#endif #endif
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) #if defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) || gsl_DEVICE_CODE
#include <cassert> #include <cassert>
#endif #endif
@ -1762,16 +1856,30 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473
#endif #endif
#define gsl_NO_OP_() (static_cast<void>(0)) #define gsl_NO_OP_() (static_cast<void>(0))
#if defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) #if gsl_COMPILER_NVHPC_VERSION
#if defined(__CUDACC__) && defined(__CUDA_ARCH__) // Suppress "controlling expression is constant" warning when using `gsl_Expects()`, `gsl_Ensures()`, `gsl_Assert()`, etc.
#define gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ _Pragma("diag_suppress 236")
#define gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ _Pragma("diag_default 236")
#else
#define gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_
#define gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_
#endif
#if gsl_DEVICE_CODE
#if defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME)
#if gsl_COMPILER_NVCC_VERSION >= 113 #if gsl_COMPILER_NVCC_VERSION >= 113
#define gsl_ASSUME_(x) ((x) ? static_cast<void>(0) : __builtin_unreachable()) #define gsl_ASSUME_(x) ((x) ? static_cast<void>(0) : __builtin_unreachable())
#define gsl_ASSUME_UNREACHABLE_() __builtin_unreachable() #define gsl_ASSUME_UNREACHABLE_() __builtin_unreachable()
#else #else // unknown device compiler
#define gsl_ASSUME_(x) gsl_ELIDE_(x) /* there is no assume intrinsic in CUDA device code */ #error gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME: gsl-lite does not know how to generate UB optimization hints in device code for this compiler; use gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE instead
#define gsl_ASSUME_UNREACHABLE_() gsl_NO_OP_() /* there is no assume intrinsic in CUDA device code */
#endif #endif
#elif gsl_COMPILER_MSVC_VERSION >= 140 #define gsl_CONTRACT_UNENFORCED_(x) gsl_ASSUME_(x)
#else // defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE ) [default]
#define gsl_CONTRACT_UNENFORCED_(x) gsl_ELIDE_(x)
#endif
#else // host code
#if defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME)
#if gsl_COMPILER_MSVC_VERSION >= 140
#define gsl_ASSUME_(x) __assume(x) #define gsl_ASSUME_(x) __assume(x)
#define gsl_ASSUME_UNREACHABLE_() __assume(0) #define gsl_ASSUME_UNREACHABLE_() __assume(0)
#elif gsl_COMPILER_GNUC_VERSION #elif gsl_COMPILER_GNUC_VERSION
@ -1787,18 +1895,41 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473
#else #else
#error gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME: gsl-lite does not know how to generate UB optimization hints for this compiler; use gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE instead #error gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME: gsl-lite does not know how to generate UB optimization hints for this compiler; use gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE instead
#endif #endif
#endif // defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME )
#if defined(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME)
#define gsl_CONTRACT_UNENFORCED_(x) gsl_ASSUME_(x) #define gsl_CONTRACT_UNENFORCED_(x) gsl_ASSUME_(x)
#else // defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE ) [default] #else // defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE ) [default]
#define gsl_CONTRACT_UNENFORCED_(x) gsl_ELIDE_(x) #define gsl_CONTRACT_UNENFORCED_(x) gsl_ELIDE_(x)
#endif #endif
#endif // gsl_DEVICE_CODE
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS) #if gsl_DEVICE_CODE
#if defined(__CUDACC__) && defined(__CUDA_ARCH__) #if gsl_COMPILER_NVCC_VERSION
#define gsl_TRAP_() __trap() #define gsl_TRAP_() __trap()
#elif gsl_COMPILER_MSVC_VERSION >= 110 // __fastfail() supported by VS 2012 and later #elif defined(__has_builtin)
#if __has_builtin(__builtin_trap)
#define gsl_TRAP_() __builtin_trap()
#else
#error gsl-lite does not know how to generate a trap instruction for this device compiler
#endif
#else
#error gsl-lite does not know how to generate a trap instruction for this device compiler
#endif
#if defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS)
#define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_(x) ? static_cast<void>(0) : gsl_TRAP_() gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (gsl_TRAP_())
#elif defined(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER)
#define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_(x) ? static_cast<void>(0) : ::gsl::fail_fast_assert_handler(#x, str, __FILE__, __LINE__) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (::gsl::fail_fast_assert_handler("", "GSL: failure", __FILE__, __LINE__), gsl_TRAP_()) /* do not let the custom assertion handler continue execution */
#else // defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS ) [default]
#if !defined(NDEBUG)
#define gsl_CONTRACT_CHECK_(str, x) assert(str && (x))
#else
#define gsl_CONTRACT_CHECK_(str, x) ((x) ? static_cast<void>(0) : gsl_TRAP_())
#endif
#define gsl_FAILFAST_() (gsl_TRAP_())
#endif
#else // host code
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS)
#if gsl_COMPILER_MSVC_VERSION >= 110 // __fastfail() supported by VS 2012 and later
#define gsl_TRAP_() __fastfail(0) /* legacy failure code for buffer-overrun errors, cf. winnt.h, "Fast fail failure codes" */ #define gsl_TRAP_() __fastfail(0) /* legacy failure code for buffer-overrun errors, cf. winnt.h, "Fast fail failure codes" */
#elif gsl_COMPILER_GNUC_VERSION #elif gsl_COMPILER_GNUC_VERSION
#define gsl_TRAP_() __builtin_trap() #define gsl_TRAP_() __builtin_trap()
@ -1811,90 +1942,106 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473
#else #else
#error gsl_CONFIG_CONTRACT_VIOLATION_TRAPS: gsl-lite does not know how to generate a trap instruction for this compiler; use gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES instead #error gsl_CONFIG_CONTRACT_VIOLATION_TRAPS: gsl-lite does not know how to generate a trap instruction for this compiler; use gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES instead
#endif #endif
#endif // defined( gsl_CONFIG_CONTRACT_VIOLATION_TRAPS ) #define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_(x) ? static_cast<void>(0) : gsl_TRAP_() gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#if gsl_COMPILER_NVHPC_VERSION
// Suppress "controlling expression is constant" warning when using gsl_Expects,
// gsl_Ensures, gsl_Assert, gsl_FailFast and so on.
#define gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ _Pragma("diag_suppress 236")
#define gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ _Pragma("diag_default 236")
#else
#define gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_
#define gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_
#endif
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER)
#define gsl_CONTRACT_CHECK_(str, x) ((x) ? static_cast<void>(0) : ::gsl::fail_fast_assert_handler(#x, str, __FILE__, __LINE__))
#if defined(__CUDACC__) && defined(__CUDA_ARCH__)
#define gsl_FAILFAST_() (::gsl::fail_fast_assert_handler("", "GSL: failure", __FILE__, __LINE__), gsl_TRAP_()) /* do not let the custom assertion handler continue execution */
#else
#define gsl_FAILFAST_() (::gsl::fail_fast_assert_handler("", "GSL: failure", __FILE__, __LINE__), ::gsl::detail::fail_fast_terminate()) /* do not let the custom assertion handler continue execution */
#endif
#elif defined(__CUDACC__) && defined(__CUDA_ARCH__)
#if defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) || !defined(NDEBUG)
#define gsl_CONTRACT_CHECK_(str, x) assert(str && (x))
#else
#define gsl_CONTRACT_CHECK_(str, x) ((x) ? static_cast<void>(0) : __trap())
#endif
#define gsl_FAILFAST_() (__trap())
#elif defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS)
#define gsl_CONTRACT_CHECK_(str, x) gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ assert(str && (x)) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_
#if !defined(NDEBUG)
#define gsl_FAILFAST_() (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ assert(!"GSL: failure") gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_, ::gsl::detail::fail_fast_terminate())
#else
#define gsl_FAILFAST_() (::gsl::detail::fail_fast_terminate())
#endif
#elif defined(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS)
#define gsl_CONTRACT_CHECK_(str, x) ((x) ? static_cast<void>(0) : gsl_TRAP_())
#if gsl_COMPILER_MSVC_VERSION #if gsl_COMPILER_MSVC_VERSION
#define gsl_FAILFAST_() (gsl_TRAP_(), ::gsl::detail::fail_fast_terminate()) #define gsl_FAILFAST_() (gsl_TRAP_(), ::gsl::detail::fail_fast_terminate())
#else #else
#define gsl_FAILFAST_() (gsl_TRAP_()) #define gsl_FAILFAST_() (gsl_TRAP_())
#endif #endif
#elif defined(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER)
#define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_(x) ? static_cast<void>(0) : ::gsl::fail_fast_assert_handler(#x, str, __FILE__, __LINE__) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (::gsl::fail_fast_assert_handler("", "GSL: failure", __FILE__, __LINE__), ::gsl::detail::fail_fast_terminate()) /* do not let the custom assertion handler continue execution */
#elif defined(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS)
#if !defined(NDEBUG)
#define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ assert(str && (x)) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ assert(!"GSL: failure") gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_, ::gsl::detail::fail_fast_abort())
#else
#define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_(x) ? static_cast<void>(0) : ::gsl::detail::fail_fast_abort() gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (::gsl::detail::fail_fast_abort())
#endif
#elif defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) #elif defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS)
#define gsl_CONTRACT_CHECK_(str, x) gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_((x) ? static_cast<void>(0) : ::gsl::detail::fail_fast_throw(str ": '" #x "' at " __FILE__ ":" gsl_STRINGIFY(__LINE__))) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ #define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_((x) ? static_cast<void>(0) : ::gsl::detail::fail_fast_throw(str ": '" #x "' at " __FILE__ ":" gsl_STRINGIFY(__LINE__))) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (::gsl::detail::fail_fast_throw("GSL: failure at " __FILE__ ":" gsl_STRINGIFY(__LINE__))) #define gsl_FAILFAST_() (::gsl::detail::fail_fast_throw("GSL: failure at " __FILE__ ":" gsl_STRINGIFY(__LINE__)))
#else // defined( gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES ) [default] #else // defined( gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES ) [default]
#define gsl_CONTRACT_CHECK_(str, x) gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_((x) ? static_cast<void>(0) : ::gsl::detail::fail_fast_terminate()) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_ #define gsl_CONTRACT_CHECK_(str, x) (gsl_SUPPRESS_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_((x) ? static_cast<void>(0) : ::gsl::detail::fail_fast_terminate()) gsl_RESTORE_NVHPC_CONTROLLING_EXPRESSION_IS_CONSTANT_)
#define gsl_FAILFAST_() (::gsl::detail::fail_fast_terminate()) #define gsl_FAILFAST_() (::gsl::detail::fail_fast_terminate())
#endif #endif
#endif // gsl_DEVICE_CODE
#if defined(gsl_CONFIG_CONTRACT_CHECKING_OFF) || defined(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF) #if (!gsl_DEVICE_CODE && defined(gsl_CONFIG_CONTRACT_CHECKING_OFF)) || (gsl_DEVICE_CODE && defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF))
#define gsl_Expects(x) gsl_CONTRACT_UNENFORCED_(x) #define gsl_CHECK_CONTRACTS_ 0
#else #define gsl_CHECK_DEBUG_CONTRACTS_ 0
#define gsl_CHECK_AUDIT_CONTRACTS_ 0
#elif (!gsl_DEVICE_CODE && defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT)) || (gsl_DEVICE_CODE && defined(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT))
#define gsl_CHECK_CONTRACTS_ 1
#define gsl_CHECK_DEBUG_CONTRACTS_ 1
#define gsl_CHECK_AUDIT_CONTRACTS_ 1
#else // gsl_CONFIG_[DEVICE_]CONTRACT_CHECKING_ON [default]
#define gsl_CHECK_CONTRACTS_ 1
#if !defined(NDEBUG)
#define gsl_CHECK_DEBUG_CONTRACTS_ 1
#else // defined( NDEBUG )
#define gsl_CHECK_DEBUG_CONTRACTS_ 0
#endif
#define gsl_CHECK_AUDIT_CONTRACTS_ 0
#endif
#if gsl_CHECK_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF)
#define gsl_Expects(x) gsl_CONTRACT_CHECK_("GSL: Precondition failure", x) #define gsl_Expects(x) gsl_CONTRACT_CHECK_("GSL: Precondition failure", x)
#else
#define gsl_Expects(x) gsl_CONTRACT_UNENFORCED_(x)
#endif #endif
#define Expects(x) gsl_Expects(x) #define Expects(x) gsl_Expects(x)
#if !defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) || defined(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF) #if gsl_CHECK_DEBUG_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF)
#define gsl_ExpectsAudit(x) gsl_ELIDE_(x) #define gsl_ExpectsDebug(x) gsl_CONTRACT_CHECK_("GSL: Precondition failure (debug)", x)
#else #else
#define gsl_ExpectsDebug(x) gsl_ELIDE_(x)
#endif
#if gsl_CHECK_AUDIT_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF)
#define gsl_ExpectsAudit(x) gsl_CONTRACT_CHECK_("GSL: Precondition failure (audit)", x) #define gsl_ExpectsAudit(x) gsl_CONTRACT_CHECK_("GSL: Precondition failure (audit)", x)
#else
#define gsl_ExpectsAudit(x) gsl_ELIDE_(x)
#endif #endif
#if defined(gsl_CONFIG_CONTRACT_CHECKING_OFF) || defined(gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF) #if gsl_CHECK_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF)
#define gsl_Ensures(x) gsl_CONTRACT_UNENFORCED_(x)
#else
#define gsl_Ensures(x) gsl_CONTRACT_CHECK_("GSL: Postcondition failure", x) #define gsl_Ensures(x) gsl_CONTRACT_CHECK_("GSL: Postcondition failure", x)
#else
#define gsl_Ensures(x) gsl_CONTRACT_UNENFORCED_(x)
#endif #endif
#define Ensures(x) gsl_Ensures(x) #define Ensures(x) gsl_Ensures(x)
#if !defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) || defined(gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF) #if gsl_CHECK_DEBUG_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF)
#define gsl_EnsuresAudit(x) gsl_ELIDE_(x) #define gsl_EnsuresDebug(x) gsl_CONTRACT_CHECK_("GSL: Postcondition failure (debug)", x)
#else #else
#define gsl_EnsuresDebug(x) gsl_ELIDE_(x)
#endif
#if gsl_CHECK_AUDIT_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF)
#define gsl_EnsuresAudit(x) gsl_CONTRACT_CHECK_("GSL: Postcondition failure (audit)", x) #define gsl_EnsuresAudit(x) gsl_CONTRACT_CHECK_("GSL: Postcondition failure (audit)", x)
#else
#define gsl_EnsuresAudit(x) gsl_ELIDE_(x)
#endif #endif
#if defined(gsl_CONFIG_CONTRACT_CHECKING_OFF) || defined(gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF) #if gsl_CHECK_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF)
#define gsl_Assert(x) gsl_CONTRACT_UNENFORCED_(x)
#else
#define gsl_Assert(x) gsl_CONTRACT_CHECK_("GSL: Assertion failure", x) #define gsl_Assert(x) gsl_CONTRACT_CHECK_("GSL: Assertion failure", x)
#endif
#if !defined(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) || defined(gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF)
#define gsl_AssertAudit(x) gsl_ELIDE_(x)
#else #else
#define gsl_Assert(x) gsl_CONTRACT_UNENFORCED_(x)
#endif
#if gsl_CHECK_DEBUG_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF)
#define gsl_AssertDebug(x) gsl_CONTRACT_CHECK_("GSL: Assertion failure (debug)", x)
#else
#define gsl_AssertDebug(x) gsl_ELIDE_(x)
#endif
#if gsl_CHECK_AUDIT_CONTRACTS_ && !defined(gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF)
#define gsl_AssertAudit(x) gsl_CONTRACT_CHECK_("GSL: Assertion failure (audit)", x) #define gsl_AssertAudit(x) gsl_CONTRACT_CHECK_("GSL: Assertion failure (audit)", x)
#else
#define gsl_AssertAudit(x) gsl_ELIDE_(x)
#endif #endif
#define gsl_FailFast() gsl_FAILFAST_() #define gsl_FailFast() gsl_FAILFAST_()
#undef gsl_CHECK_CONTRACTS_
#undef gsl_CHECK_DEBUG_CONTRACTS_
#undef gsl_CHECK_AUDIT_CONTRACTS_
struct fail_fast : public std::logic_error struct fail_fast : public std::logic_error
{ {
@ -1914,6 +2061,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473
{ {
std::terminate(); std::terminate();
} }
gsl_NORETURN inline void fail_fast_abort() gsl_noexcept
{
std::abort();
}
} // namespace detail } // namespace detail
@ -3197,18 +3348,33 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473
} }
#endif // gsl_HAVE( MOVE_FORWARD ) #endif // gsl_HAVE( MOVE_FORWARD )
template <class T> template <class T>
gsl_NODISCARD gsl_api gsl_constexpr14 T const &as_nullable(not_null<T> const &p) gsl_NODISCARD gsl_api gsl_constexpr14 T const &
as_nullable(not_null<T> const &p)
{ {
T const &result = detail::not_null_accessor<T>::get(p); T const &result = detail::not_null_accessor<T>::get(p);
gsl_Expects(result != gsl_nullptr); gsl_Expects(result != gsl_nullptr);
return result; return result;
} }
template <class T> template <class T>
gsl_NODISCARD gsl_api gsl_constexpr T *as_nullable(not_null<T *> p) gsl_noexcept gsl_NODISCARD gsl_api gsl_constexpr T *
as_nullable(not_null<T *> p) gsl_noexcept
{ {
return detail::not_null_accessor<T *>::get(p); return detail::not_null_accessor<T *>::get(p);
} }
template <class T>
gsl_NODISCARD gsl_api gsl_constexpr bool
is_valid(not_null<T> const &p)
{
return detail::not_null_accessor<T>::get(p) != gsl_nullptr;
}
template <class T>
gsl_NODISCARD gsl_api gsl_constexpr bool
is_valid(not_null<T *> const &)
{
return true;
}
} // namespace no_adl } // namespace no_adl
} // namespace detail } // namespace detail

View File

@ -36,6 +36,14 @@ target_link_libraries(obs_gr_blocks
Matio::matio Matio::matio
) )
if(GNURADIO_USES_SPDLOG)
target_link_libraries(obs_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(obs_gr_blocks target_include_directories(obs_gr_blocks
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/interfaces

View File

@ -50,6 +50,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(NOT GNURADIO_USES_LOG4CPP)
target_link_libraries(resampler_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(resampler_gr_blocks target_include_directories(resampler_gr_blocks
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/interfaces

View File

@ -44,6 +44,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_generator_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_CLANG_TIDY) if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE) if(CLANG_TIDY_EXE)
set_target_properties(signal_generator_adapters set_target_properties(signal_generator_adapters

View File

@ -21,12 +21,12 @@
#include "INIReader.h" #include "INIReader.h"
#include "command_event.h" #include "command_event.h"
#include "gnss_sdr_make_unique.h" #include "gnss_sdr_make_unique.h"
#include <boost/any.hpp>
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <bitset> #include <bitset>
#include <exception> #include <exception>
#include <iomanip>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <sstream> #include <sstream>

View File

@ -78,6 +78,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_source_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
target_link_libraries(signal_source_libs target_link_libraries(signal_source_libs
PUBLIC PUBLIC

View File

@ -59,6 +59,12 @@ Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(const std::string &device
shift_out_bits_band1 = shift_out_bits_default; shift_out_bits_band1 = shift_out_bits_default;
shift_out_bits_band2 = shift_out_bits_default; shift_out_bits_band2 = shift_out_bits_default;
// init bit selection corresopnding to frequency band 1
d_map_base1[0] = shift_out_bits_band1;
// init bit selection corresponding to frequency band 2
d_map_base2[0] = shift_out_bits_band2;
DLOG(INFO) << "Dynamic bit selection FPGA class created"; DLOG(INFO) << "Dynamic bit selection FPGA class created";
} }

View File

@ -68,6 +68,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(telemetry_decoder_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(telemetry_decoder_gr_blocks target_include_directories(telemetry_decoder_gr_blocks
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/interfaces

View File

@ -882,15 +882,13 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
d_inav_nav.set_TOW6_flag(false); d_inav_nav.set_TOW6_flag(false);
} }
// warning: type 0 frame does not contain a valid TOW in some simulated signals, thus it is not safe to activate the following code: else if (d_inav_nav.is_TOW0_set() == true) // page 0 arrived and decoded
// else if (d_inav_nav.is_TOW0_set() == true) // page 0 arrived and decoded {
// { // TOW_0 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
// // TOW_0 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW0() * 1000.0);
// d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW0() * 1000.0); d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); d_inav_nav.set_TOW0_flag(false);
// d_inav_nav.set_TOW0_flag(false); }
// // std::cout << "FRAME 0 current tow: " << tmp_d_TOW_at_current_symbol_ms << " vs. " << d_TOW_at_current_symbol_ms + d_PRN_code_period_ms << "\n";
// }
else else
{ {
// this page has no timing information // this page has no timing information

View File

@ -73,6 +73,14 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(core_monitor
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_BOOST_ASIO_IO_CONTEXT) if(USE_BOOST_ASIO_IO_CONTEXT)
target_compile_definitions(core_monitor target_compile_definitions(core_monitor
PUBLIC PUBLIC

View File

@ -62,6 +62,10 @@ else()
) )
endif() endif()
if(CMAKE_ANDROID_ARCH_ABI)
target_compile_definitions(core_receiver PUBLIC -DANDROID=1)
endif()
if(ENABLE_FPGA) if(ENABLE_FPGA)
target_compile_definitions(core_receiver PUBLIC -DENABLE_FPGA=1) target_compile_definitions(core_receiver PUBLIC -DENABLE_FPGA=1)
endif() endif()

View File

@ -418,7 +418,11 @@ int ControlThread::run()
{ {
pthread_t id = keyboard_thread_.native_handle(); pthread_t id = keyboard_thread_.native_handle();
keyboard_thread_.detach(); keyboard_thread_.detach();
#ifndef ANDROID
pthread_cancel(id); pthread_cancel(id);
#else
// todo: find alternative
#endif
} }
// Terminate telecommand thread // Terminate telecommand thread
@ -426,7 +430,11 @@ int ControlThread::run()
{ {
pthread_t id2 = cmd_interface_thread_.native_handle(); pthread_t id2 = cmd_interface_thread_.native_handle();
cmd_interface_thread_.detach(); cmd_interface_thread_.detach();
#ifndef ANDROID
pthread_cancel(id2); pthread_cancel(id2);
#else
// todo: find alternative
#endif
} }
LOG(INFO) << "Flowgraph stopped"; LOG(INFO) << "Flowgraph stopped";

View File

@ -36,6 +36,8 @@
#include "test_flags.h" #include "test_flags.h"
#include "tracking_tests_flags.h" // acquisition resampler #include "tracking_tests_flags.h" // acquisition resampler
#include <armadillo> #include <armadillo>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/exception.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <matio.h> #include <matio.h>

View File

@ -24,6 +24,8 @@
#include "gps_acq_assist.h" #include "gps_acq_assist.h"
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/exception.hpp>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>

View File

@ -53,6 +53,14 @@ target_include_directories(signal_processing_testing_lib
${CMAKE_SOURCE_DIR}/src/tests/common-files ${CMAKE_SOURCE_DIR}/src/tests/common-files
) )
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_processing_testing_lib
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_GENERIC_LAMBDAS) if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)

View File

@ -53,6 +53,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <fstream> #include <fstream>
#include <iomanip>
#include <map> #include <map>
#include <set> #include <set>
#include <stdexcept> #include <stdexcept>