Skip to content

Implement diagnostic ignore macro for Clang #12467

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

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 19 additions & 8 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -737,19 +737,30 @@ extern "C++" {
# define ZEND_INDIRECT_RETURN
#endif

#if __GNUC__ && !defined(__clang__)
# define __DO_PRAGMA(x) _Pragma(#x)
# define _DO_PRAGMA(x) __DO_PRAGMA(x)
# define ZEND_CGG_DIAGNOSTIC_IGNORED_START(warning) \
#define __ZEND_DO_PRAGMA(x) _Pragma(#x)
#define _ZEND_DO_PRAGMA(x) __ZEND_DO_PRAGMA(x)
#if defined(__clang__)
# define ZEND_DIAGNOSTIC_IGNORED_START(warning) \
_Pragma("clang diagnostic push") \
_ZEND_DO_PRAGMA(clang diagnostic ignored warning)
# define ZEND_DIAGNOSTIC_IGNORED_END \
_Pragma("clang diagnostic pop")
#elif defined(__GNUC__)
# define ZEND_DIAGNOSTIC_IGNORED_START(warning) \
_Pragma("GCC diagnostic push") \
_DO_PRAGMA(GCC diagnostic ignored warning)
# define ZEND_CGG_DIAGNOSTIC_IGNORED_END \
_ZEND_DO_PRAGMA(GCC diagnostic ignored warning)
# define ZEND_DIAGNOSTIC_IGNORED_END \
_Pragma("GCC diagnostic pop")
#else
# define ZEND_CGG_DIAGNOSTIC_IGNORED_START(warning)
# define ZEND_CGG_DIAGNOSTIC_IGNORED_END
# define ZEND_DIAGNOSTIC_IGNORED_START(warning)
# define ZEND_DIAGNOSTIC_IGNORED_END
#endif

/** @deprecated */
#define ZEND_CGG_DIAGNOSTIC_IGNORED_START ZEND_DIAGNOSTIC_IGNORED_START
/** @deprecated */
#define ZEND_CGG_DIAGNOSTIC_IGNORED_END ZEND_DIAGNOSTIC_IGNORED_END

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# define ZEND_STATIC_ASSERT(c, m) _Static_assert((c), m)
#else
Expand Down
4 changes: 2 additions & 2 deletions ext/imap/php_imap.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
# endif

/* these are used for quota support */
ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
ZEND_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
# include "c-client.h" /* includes mail.h and rfc822.h */
ZEND_CGG_DIAGNOSTIC_IGNORED_END
ZEND_DIAGNOSTIC_IGNORED_END
# include "imap4r1.h" /* location of c-client quota functions */
#else
# include "mail.h"
Expand Down
4 changes: 2 additions & 2 deletions ext/oci8/php_oci8_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
/* }}} */

#include "ext/standard/php_string.h"
ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
ZEND_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
#include <oci.h>
ZEND_CGG_DIAGNOSTIC_IGNORED_END
ZEND_DIAGNOSTIC_IGNORED_END

#if !defined(OCI_MAJOR_VERSION) || OCI_MAJOR_VERSION < 11 || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION < 2))
#error This version of PHP OCI8 requires Oracle Client libraries from 11.2 or later.
Expand Down
4 changes: 2 additions & 2 deletions ext/pdo_oci/php_pdo_oci_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

#include "zend_portability.h"

ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
ZEND_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
#include <oci.h>
ZEND_CGG_DIAGNOSTIC_IGNORED_END
ZEND_DIAGNOSTIC_IGNORED_END

typedef struct {
const char *file;
Expand Down
4 changes: 2 additions & 2 deletions ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -2387,11 +2387,11 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
if (soap_version == SOAP_1_1) {
smart_str_0(&array_type);
#if defined(__GNUC__) && __GNUC__ >= 11
ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstringop-overread")
ZEND_DIAGNOSTIC_IGNORED_START("-Wstringop-overread")
#endif
bool is_xsd_any_type = strcmp(ZSTR_VAL(array_type.s),"xsd:anyType") == 0;
#if defined(__GNUC__) && __GNUC__ >= 11
ZEND_CGG_DIAGNOSTIC_IGNORED_END
ZEND_DIAGNOSTIC_IGNORED_END
#endif
if (is_xsd_any_type) {
smart_str_free(&array_type);
Expand Down