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

[hiredis] Fix the conflict of macro ssize_t #25271

Merged

Conversation

JackBoosY
Copy link
Contributor

When using hiredis and libuv at the same time, the definition of ssize_t will conflict:

F:\vcpkg\installed\x86-windows\include\hiredis/hiredis.h(42): error C2371: 'ssize_t': redefinition; different basic types
f:\vcpkg\installed\x86-windows\include\uv/win.h(27): note: see declaration of 'ssize_t'
f:\vcpkg\installed\x86-windows\include\hiredis\sds.h(39): error C2371: 'ssize_t': redefinition; different basic types
f:\vcpkg\installed\x86-windows\include\uv/win.h(27): note: see declaration of 'ssize_t'
f:\vcpkg\installed\x86-windows\include\hiredis\sds.h(40): warning C4005: 'SSIZE_MAX': macro redefinition
f:\vcpkg\installed\x86-windows\include\uv/win.h(28): note: see previous definition of 'SSIZE_MAX'

In include/hiredis/hiredis.h line 34-47:

#ifndef __HIREDIS_H
#define __HIREDIS_H
#include "read.h"
#include <stdarg.h> /* for va_list */
#ifndef _MSC_VER
#include <sys/time.h> /* for struct timeval */
#else
struct timeval; /* forward declaration */
typedef long long ssize_t;
#define _SSIZE_T_ /* for compatibility with libuv */
#endif
#include <stdint.h> /* uintXX_t, etc */
#include "sds.h" /* for sds */
#include "alloc.h" /* for allocation wrappers */

In include/hiredis/sds.h line 33-45:

#ifndef __SDS_H
#define __SDS_H

#define SDS_MAX_PREALLOC (1024*1024)
#ifdef _MSC_VER
#define __attribute__(x)
typedef long long ssize_t;
#define SSIZE_MAX (LLONG_MAX >> 1)
#endif

#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>

In include/uv/win.h line 26-33:

#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
typedef intptr_t ssize_t;
# define SSIZE_MAX INTPTR_MAX
# define _SSIZE_T_
# define _SSIZE_T_DEFINED
#endif

Obviously, libuv restricts the redefinition of ssize_t, but hiredis does not.

Fix this.

@JackBoosY JackBoosY added category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team. labels Jun 16, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 3d8f78171a2a37d461077bf8d063256b63e25a4f -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/baseline.json b/versions/baseline.json
index cfa3bca..e4dabec 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -2810,7 +2810,7 @@
     },
     "hiredis": {
       "baseline": "1.0.2",
-      "port-version": 3
+      "port-version": 4
     },
     "hps": {
       "baseline": "2022-01-18",
diff --git a/versions/h-/hiredis.json b/versions/h-/hiredis.json
index 36c7df6..d641b89 100644
--- a/versions/h-/hiredis.json
+++ b/versions/h-/hiredis.json
@@ -1,5 +1,10 @@
 {
   "versions": [
+    {
+      "git-tree": "61a9442976602c2c980a40ee0ac3206a43bfd748",
+      "version": "1.0.2",
+      "port-version": 4
+    },
     {
       "git-tree": "4eafe5d23a2d906153cc8821c14092f2a9d3ef8a",
       "version": "1.0.2",

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/hiredis/vcpkg.json

Valid values for the license field can be found in the documentation

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/hiredis/vcpkg.json

Valid values for the license field can be found in the documentation

LilyWangLL
LilyWangLL previously approved these changes Jun 17, 2022
@LilyWangLL LilyWangLL added the info:reviewed Pull Request changes follow basic guidelines label Jun 17, 2022
@dan-shaw dan-shaw added requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. and removed info:reviewed Pull Request changes follow basic guidelines labels Jun 17, 2022
@JackBoosY
Copy link
Contributor Author

@dan-shaw Please don't remove the reviewed tag, as it is used by other members to filter PRs to query for PRs that need further review.

@JackBoosY JackBoosY added info:reviewed Pull Request changes follow basic guidelines and removed requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. labels Jun 24, 2022
@dan-shaw dan-shaw added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jul 2, 2022
github-actions[bot]
github-actions bot previously approved these changes Jul 5, 2022
@LilyWangLL LilyWangLL added requires:author-response and removed info:reviewed Pull Request changes follow basic guidelines labels Jul 8, 2022
Co-authored-by: Billy O'Neal <bion@microsoft.com>
@JackBoosY JackBoosY dismissed stale reviews from github-actions and LilyWangLL via 15a25d9 July 8, 2022 06:34
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for hiredis have changed but the version was not updated
version: 1.0.2#4
old SHA: f7763af93472b87cd743ed95d74f0d4a4361a700
new SHA: 448374fa990c04aa7964508d32817a6d7868600b
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

versions/h-/hiredis.json Outdated Show resolved Hide resolved
@JackBoosY JackBoosY requested a review from BillyONeal July 8, 2022 06:53
@vicroms vicroms removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jul 12, 2022
@BillyONeal BillyONeal merged commit 8b14e7e into microsoft:master Jul 14, 2022
Jimmy-Hu added a commit to Jimmy-Hu/vcpkg that referenced this pull request Jul 14, 2022
[hiredis] Fix the conflict of macro ssize_t (microsoft#25271)
@JackBoosY JackBoosY deleted the dev/jack/fix-hiredis-ssize_t-conflict branch July 14, 2022 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants