Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Vendor cpp11 headers #451

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0)
LinkingTo:
cpp11,
plogr (>= 0.2.0)
VignetteBuilder:
knitr
Expand Down
4 changes: 2 additions & 2 deletions man/RPostgres-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PKG_CPPFLAGS=@cflags@ -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR @plogr@
PKG_CPPFLAGS=@cflags@ -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR @plogr@ -Ivendor/cpp11

PKG_CFLAGS=$(C_VISIBILITY)
PKG_CXXFLAGS=$(CXX_VISIBILITY)
Expand Down
2 changes: 1 addition & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RWINLIB = ../windows/libpq
PKG_CPPFLAGS = -I$(RWINLIB)/include -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR
PKG_CPPFLAGS = -I$(RWINLIB)/include -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR -Ivendor/cpp11
PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \
-lpq -lpgport -lpgcommon -lssl -lcrypto -lwsock32 -lsecur32 -lws2_32 -lgdi32 -lcrypt32 -lwldap32

Expand Down
26 changes: 26 additions & 0 deletions src/vendor/cpp11/cpp11.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// cpp11 version: 0.4.6
// vendored on: 2023-11-08
#pragma once

#include "cpp11/R.hpp"
#include "cpp11/altrep.hpp"
#include "cpp11/as.hpp"
#include "cpp11/attribute_proxy.hpp"
#include "cpp11/data_frame.hpp"
#include "cpp11/doubles.hpp"
#include "cpp11/environment.hpp"
#include "cpp11/external_pointer.hpp"
#include "cpp11/function.hpp"
#include "cpp11/integers.hpp"
#include "cpp11/list.hpp"
#include "cpp11/list_of.hpp"
#include "cpp11/logicals.hpp"
#include "cpp11/matrix.hpp"
#include "cpp11/named_arg.hpp"
#include "cpp11/protect.hpp"
#include "cpp11/r_bool.hpp"
#include "cpp11/r_string.hpp"
#include "cpp11/r_vector.hpp"
#include "cpp11/raws.hpp"
#include "cpp11/sexp.hpp"
#include "cpp11/strings.hpp"
63 changes: 63 additions & 0 deletions src/vendor/cpp11/cpp11/R.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// cpp11 version: 0.4.6
// vendored on: 2023-11-08
#pragma once

#ifdef R_INTERNALS_H_
#if !(defined(R_NO_REMAP) && defined(STRICT_R_HEADERS))
#error R headers were included before cpp11 headers \
and at least one of R_NO_REMAP or STRICT_R_HEADERS \
was not defined.
#endif
#endif

#define R_NO_REMAP
#define STRICT_R_HEADERS
#include "Rinternals.h"

// clang-format off
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wattributes"
#endif

#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wattributes"
#endif
// clang-format on

#include <type_traits>
#include "cpp11/altrep.hpp"

namespace cpp11 {
namespace literals {

constexpr R_xlen_t operator"" _xl(unsigned long long int value) { return value; }

} // namespace literals

namespace traits {
template <typename T>
struct get_underlying_type {
using type = T;
};
} // namespace traits

template <typename T>
inline T na();

template <typename T>
inline typename std::enable_if<!std::is_same<typename std::decay<T>::type, double>::value,
bool>::type
is_na(const T& value) {
return value == na<T>();
}

template <typename T>
inline typename std::enable_if<std::is_same<typename std::decay<T>::type, double>::value,
bool>::type
is_na(const T& value) {
return ISNA(value);
}

} // namespace cpp11
44 changes: 44 additions & 0 deletions src/vendor/cpp11/cpp11/altrep.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// cpp11 version: 0.4.6
// vendored on: 2023-11-08
#pragma once

#include "Rversion.h"

#if defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
#define HAS_ALTREP
#endif

#ifndef HAS_ALTREP

#define ALTREP(x) false

#define REAL_ELT(x, i) REAL(x)[i]
#define INTEGER_ELT(x, i) INTEGER(x)[i]
#define LOGICAL_ELT(x, i) LOGICAL(x)[i]
#define RAW_ELT(x, i) RAW(x)[i]

#define SET_REAL_ELT(x, i, val) REAL(x)[i] = val
#define SET_INTEGER_ELT(x, i, val) INTEGER(x)[i] = val
#define SET_LOGICAL_ELT(x, i, val) LOGICAL(x)[i] = val
#define SET_RAW_ELT(x, i, val) RAW(x)[i] = val

#define REAL_GET_REGION(...) \
do { \
} while (false)

#define INTEGER_GET_REGION(...) \
do { \
} while (false)
#endif

#if !defined HAS_ALTREP || (defined(R_VERSION) && R_VERSION < R_Version(3, 6, 0))

#define LOGICAL_GET_REGION(...) \
do { \
} while (false)

#define RAW_GET_REGION(...) \
do { \
} while (false)

#endif
Loading
Loading