Skip to content

Move isinf, isnan, and isfinite to zend_portability.h #4966

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
14 changes: 14 additions & 0 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,20 @@ char *alloca();

#define ZEND_NAN NAN

#if defined(__cplusplus) && __cplusplus >= 201103L
extern "C++" {
Copy link
Member

Choose a reason for hiding this comment

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

The extern block shouldn't be indented.

# include <cmath>
# define zend_isnan std::isnan
# define zend_isinf std::isinf
# define zend_finite std::isfinite
}
Copy link
Member

Choose a reason for hiding this comment

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

For clarity, it's better to put the } right after the include, not the defines.

#else
# include <math.h>
# define zend_isnan(a) isnan(a)
# define zend_isinf(a) isinf(a)
# define zend_finite(a) isfinite(a)
#endif

#define ZEND_STRL(str) (str), (sizeof(str)-1)
#define ZEND_STRS(str) (str), (sizeof(str))
#define ZEND_NORMALIZE_BOOL(n) \
Expand Down
15 changes: 0 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,6 @@ AH_BOTTOM([

#include <string.h>

#if defined(__cplusplus) && __cplusplus >= 201103L
extern "C++" {
#include <cmath>
#define zend_isnan std::isnan
#define zend_isinf std::isinf
#define zend_finite std::isfinite
}
#else
#include <math.h>

#define zend_isnan(a) isnan(a)
#define zend_isinf(a) isinf(a)
#define zend_finite(a) isfinite(a)

#endif
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */

#endif /* PHP_CONFIG_H */
Expand Down