mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
Introduce "must use attribute"
Conditionally add `[[nodiscard]]` (c23) or `__attribute__((warn_unused_result))` when the compiler supports it. This commit initially just adds iit to `cluster_map_keyspace` but we can go throughour API adding it where appropriate.
This commit is contained in:
committed by
Michael Grunder
parent
5ebb853e1a
commit
547475295a
@@ -378,7 +378,7 @@ PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout,
|
||||
int failover, int persistent);
|
||||
PHP_REDIS_API void cluster_free(redisCluster *c, int free_ctx);
|
||||
PHP_REDIS_API void cluster_init_seeds(redisCluster *c, zend_string **seeds, uint32_t nseeds);
|
||||
PHP_REDIS_API int cluster_map_keyspace(redisCluster *c);
|
||||
REDIS_NODISCARD PHP_REDIS_API int cluster_map_keyspace(redisCluster *c);
|
||||
PHP_REDIS_API void cluster_free_node(redisClusterNode *node);
|
||||
|
||||
/* Functions for interacting with cached slots maps */
|
||||
|
||||
25
common.h
25
common.h
@@ -41,6 +41,31 @@
|
||||
# error "Unknown endianness"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define REDIS_MSVC 1
|
||||
#endif
|
||||
|
||||
#ifndef REDIS_MSVC
|
||||
# if defined(__has_c_attribute)
|
||||
# if __has_c_attribute(nodiscard)
|
||||
# define REDIS_NODISCARD [[nodiscard]]
|
||||
# endif
|
||||
# endif
|
||||
# ifndef REDIS_NODISCARD
|
||||
# if defined(__has_attribute)
|
||||
# if __has_attribute(warn_unused_result)
|
||||
# define REDIS_NODISCARD __attribute__((warn_unused_result))
|
||||
# endif
|
||||
# elif defined(__GNUC__) || defined(__clang__)
|
||||
# define REDIS_NODISCARD __attribute__((warn_unused_result))
|
||||
# else
|
||||
# define REDIS_NODISCARD
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define REDIS_NODISCARD
|
||||
#endif
|
||||
|
||||
#include "backoff.h"
|
||||
|
||||
typedef enum {
|
||||
|
||||
Reference in New Issue
Block a user