aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-03-20 18:18:47 +0300
committerthegeorg <thegeorg@yandex-team.ru>2022-03-20 18:18:47 +0300
commite7aae615944a704e320aaea56e0cebfa2dcf2959 (patch)
treeb4344342333eba39cd91d76d364dea8b23d1fe51
parent5ce3a9912f6b93afbdd0bb3ae96aed39aa616340 (diff)
downloadydb-e7aae615944a704e320aaea56e0cebfa2dcf2959.tar.gz
util: Do not define SIZEOF_SIZE_T, as it is not used in our codebase
codesearch shows [114 usages](https://a.yandex-team.ru/search?search=%5CbSIZEOF_SIZE_T%5Cb,,jC,arcadia,,500) of this macro outside of contrib. None of these usages looks as being util-dependent. Defining this in util triggers `-Wmacro-redefined` whenever `` gets included after our ``. UPD: It turns out that our curl was using this define for a reason, so I have implemented an util-independent solution instead. ref:c80e45c42a9c0ec76eda33e63b560b285e1ee502
-rw-r--r--contrib/libs/curl/lib/curl_config-linux.h4
-rw-r--r--contrib/libs/curl/lib/curl_config-osx.h5
-rw-r--r--contrib/libs/curl/lib/curl_config-win.h5
-rw-r--r--contrib/libs/curl/lib/curl_config-x32.h2
-rw-r--r--contrib/libs/curl/lib/curl_config-x64.h2
-rw-r--r--contrib/libs/curl/lib/curl_config.h8
-rw-r--r--util/system/platform.h5
-rw-r--r--util/system/platform_ut.cpp1
8 files changed, 14 insertions, 18 deletions
diff --git a/contrib/libs/curl/lib/curl_config-linux.h b/contrib/libs/curl/lib/curl_config-linux.h
index 0dfa912535..c369adc9cd 100644
--- a/contrib/libs/curl/lib/curl_config-linux.h
+++ b/contrib/libs/curl/lib/curl_config-linux.h
@@ -968,9 +968,7 @@
#endif
/* The number of bytes in type size_t */
-#ifndef SIZEOF_SIZE_T
-#error undefined SIZEOF_SIZE_T
-#endif
+#define SIZEOF_SIZE_T 8
/* The number of bytes in type time_t */
#define SIZEOF_TIME_T SIZEOF_LONG
diff --git a/contrib/libs/curl/lib/curl_config-osx.h b/contrib/libs/curl/lib/curl_config-osx.h
index a18d7a75e7..37e6f39ef3 100644
--- a/contrib/libs/curl/lib/curl_config-osx.h
+++ b/contrib/libs/curl/lib/curl_config-osx.h
@@ -935,11 +935,6 @@
#error undefined SIZEOF_SHORT
#endif
-/* The number of bytes in type size_t */
-#ifndef SIZEOF_SIZE_T
-#error undefined SIZEOF_SIZE_T
-#endif
-
/* The number of bytes in type time_t */
#define SIZEOF_TIME_T SIZEOF_LONG
diff --git a/contrib/libs/curl/lib/curl_config-win.h b/contrib/libs/curl/lib/curl_config-win.h
index 0e02013b43..24d2561fba 100644
--- a/contrib/libs/curl/lib/curl_config-win.h
+++ b/contrib/libs/curl/lib/curl_config-win.h
@@ -951,11 +951,6 @@
/* The size of `curl_off_t', as computed by sizeof. */
#define SIZEOF_CURL_OFF_T 8
-/* The size of `size_t', as computed by sizeof. */
-#ifndef SIZEOF_SIZE_T
-#error undefined SIZEOF_SIZE_T
-#endif
-
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 8
diff --git a/contrib/libs/curl/lib/curl_config-x32.h b/contrib/libs/curl/lib/curl_config-x32.h
new file mode 100644
index 0000000000..1c90f5b509
--- /dev/null
+++ b/contrib/libs/curl/lib/curl_config-x32.h
@@ -0,0 +1,2 @@
+#undef SIZEOF_SIZE_T
+#define SIZEOF_SIZE_T 4
diff --git a/contrib/libs/curl/lib/curl_config-x64.h b/contrib/libs/curl/lib/curl_config-x64.h
new file mode 100644
index 0000000000..3ed4cc41db
--- /dev/null
+++ b/contrib/libs/curl/lib/curl_config-x64.h
@@ -0,0 +1,2 @@
+#undef SIZEOF_SIZE_T
+#define SIZEOF_SIZE_T 8
diff --git a/contrib/libs/curl/lib/curl_config.h b/contrib/libs/curl/lib/curl_config.h
index e58dec7079..f6dc46ab83 100644
--- a/contrib/libs/curl/lib/curl_config.h
+++ b/contrib/libs/curl/lib/curl_config.h
@@ -22,6 +22,14 @@
# include "curl_config-musl.h"
#endif
+#if defined(__i686__) || defined(_M_IX86) || defined(__arm__) || defined(__ARM__)
+# include "curl_config-x32.h"
+#endif
+
+#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(__powerpc64__)
+# include "curl_config-x64.h"
+#endif
+
// Do not misrepresent host on Android and iOS.
#undef OS
#define OS "arcadia"
diff --git a/util/system/platform.h b/util/system/platform.h
index 58f310ab34..b085cf5b1b 100644
--- a/util/system/platform.h
+++ b/util/system/platform.h
@@ -87,7 +87,7 @@
* Microsoft can define _M_IX86, _M_AMD64 (before Visual Studio 8)
* or _M_X64 (starting in Visual Studio 8).
*/
-#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64)
+#if defined(__x86_64__) || defined(_M_X64)
#define _x86_64_
#endif
@@ -240,7 +240,4 @@
#define SIZEOF_LONG_LONG 8
#define SIZEOF_UNSIGNED_LONG_LONG 8
-#undef SIZEOF_SIZE_T // in case we include <Python.h> which defines it, too
-#define SIZEOF_SIZE_T SIZEOF_PTR
-
// clang-format on
diff --git a/util/system/platform_ut.cpp b/util/system/platform_ut.cpp
index 9bfbce8315..559a6219aa 100644
--- a/util/system/platform_ut.cpp
+++ b/util/system/platform_ut.cpp
@@ -15,7 +15,6 @@ private:
UNIT_ASSERT_EQUAL(SIZEOF_INT, sizeof(int));
UNIT_ASSERT_EQUAL(SIZEOF_LONG, sizeof(long));
UNIT_ASSERT_EQUAL(SIZEOF_LONG_LONG, sizeof(long long));
- UNIT_ASSERT_EQUAL(SIZEOF_SIZE_T, sizeof(size_t));
UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_CHAR, sizeof(unsigned char));
UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_INT, sizeof(unsigned int));
UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_LONG, sizeof(unsigned long));