Commit Graph

103 Commits

Author SHA1 Message Date
George Peter Banyard
67f85573c5 Remove custom implementation for inifinity and NAN as we can now rely on C99
Those ZEND_* constant variant are now identical to their C counterpart, we may considering removing them in the future.
2019-12-04 13:17:20 +01:00
Nikita Popov
dacadf5aa3 Disable ifunc resolvers under thread sanitizer as well 2019-11-07 13:08:03 +01:00
Nikita Popov
451314111b Revert "Remove configure checks for supported instruction sets"
This reverts commit edccf32f7f.

This was reported to cause issues for as yet unknown reasons in
bug #78769. As this was intended as code cleanup, revert this from
7.4 at least. May reapply it to master later.
2019-11-04 11:32:46 +01:00
Nikita Popov
edccf32f7f Remove configure checks for supported instruction sets
These were checking whether the instruction set is supported by
the host CPU, however they were only used to condition on whether
this instruction set is targeted at all. It would still use dynamic
dispatch (e.g. based on ifunc resolvers) to select the actual
implementation. Whether the target is guaranteed to support the
instruction set without dispatch is determined based on pre-defined
macros like __SSE2__.

This removes the configure-time builtin cpu checks to remove
confusion. Additionally this allows targeting an architecture that
is newer than the host architecture.
2019-10-31 11:27:53 +01:00
Nikita Popov
ec30a3b171 Include stddef.h in zend_portability.h for offsetof() macro
This makes sure that we use compiler builtins when they are
available and thus avoid ubsan warnings in clang.

And also reindent the fallback implementation.
2019-09-14 00:24:47 +02:00
Nikita Popov
77a0fa101e Reenable alloca support on ZTS
This got disabled due to an incorrect change in a preprocessor condition
in 2104bea5d7. It was not supposed to
be disabled.
2019-08-30 17:24:06 +02:00
Nikita Popov
736172d23d Disable RTLD_DEEPBIND under memory sanitizer
This was already done for address sanitizer.
2019-07-01 09:37:34 +02:00
Nikita Popov
2c8819b89c Disable ifunc resolvers if memory sanitizer is used
Just marking them as no_sanitize("memory") is unforunately not
sufficient, as the function still gets instrumented -- the attribute
only disables reporting.
2019-06-28 17:15:56 +02:00
Nikita Popov
8f63e7e324 Make ATTRIBUTE_UNUSED more portable 2019-06-12 14:29:23 +02:00
Dmitry Stogov
cf388033d5 Reduce register pressure by reloading values on CPUs with few general purpose registers 2019-05-31 00:14:10 +03:00
Nikita Popov
c51eafe931 Remove restrict zend_portability define
We're not using this anywhere, and it causes warnings, so I'm
dropping it. If we do end up needing this, it should be reintroduced
with a ZEND_ prefix.
2019-04-11 15:32:30 +02:00
Peter Kokot
fd1ad1e25a Remove HAVE_LIMITS_H
The `<limits.h>` header file is part of the standard C89 headers [1]
and on current systems can be included unconditionally.

Since PHP requires at least C89 or greater, the `HAVE_LIMITS_H` symbol
defined by Autoconf in configure.ac [2] can be ommitted and simplifed
however due to bundled file library (libmagic) and timelib still using
it, the removal there was omitted and done only in Zend.m4 file.

Current bundled libraries libtime, oniguruma, and libmagic still include
partial `HAVE_LIMITS_H` usage and will be more refactored when this is
possible.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
2019-04-07 15:20:02 +02:00
Nikita Popov
1b411c039f Merge branch 'PHP-7.3' into PHP-7.4 2019-03-18 10:14:03 +01:00
Nikita Popov
c4464526cd Remove x86 bit test optimization
This is undefined behavior and we cannot rely on it. Additionally it
breaks builds using undefined behavior sanitizers.
2019-03-18 10:12:15 +01:00
Remi Collet
d633cbac1c add --enable-rtld-now build option to change dlopen behavior 2019-03-12 08:23:06 +01:00
Nikita Popov
dab5462484 Use #ifdef instead of #if 2019-02-14 11:56:33 +01:00
Nikita Popov
96daef0458 Make ABI of SIMD optimized functions independent of compiler flags
Always export these as normal functions and only use function pointers
internally if necessary.
2019-02-14 11:49:21 +01:00
Nikita Popov
3ece2640ea Merge branch 'PHP-7.3' into PHP-7.4 2019-02-14 10:02:58 +01:00
Nikita Popov
7bc162f928 Work around compiler flag dependent ABI 2019-02-14 09:59:10 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Peter Kokot
b189c2432a Remove HAVE_STDARG_H
The C89 standard and later defines the `<stdarg.h>` header as part of
the standard headers [1]. On current systems it is always present and
can be included unconditionally.

Checking for presence and functionality of the `<stdarg.h>` header and
variadic function is not relevant anymore on current systems since this
is always available.

Also Autoconf suggests relying on at least C89 or above [2] and [3].

The following files were regenerated with re2c 1.0.3:
- Zend/zend_language_scanner.c
- Zend/zend_language_scanner_defs.h

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
[3] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/autoconf.html
2018-09-18 05:44:56 +02:00
Anatol Belski
36857ab52b Fix clang compilation
By usage of -fmodules, all the intrinsic items are loaded automatically.
The headers included come however from Visual Studio, thus bringing some
conflicting declarations. On the other hand, -fmodules is needed to
mitigate linking issues with clang in VS compatibility mode.
2018-08-01 16:19:54 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Anatol Belski
f87cc89f4d Gereralize VA macro expansion mechanism
Avoids code duplication and makes in usable elsewhere.
2018-06-21 11:50:48 +02:00
Dmitry Stogov
531de5f24a Fixed prototypes, foo(void) instead of foo() 2018-06-06 15:26:26 +03:00
Anatol Belski
8ebb6e1d9d Extend compile conditions 2018-05-15 11:57:32 +02:00
Dmitry Stogov
4ad9cf4605 Bit test optimization 2018-05-08 11:58:17 +03:00
Xinchen Hui
12ee810960 Attempt to fix build with gcc-4.8 2018-03-01 18:34:39 +08:00
Xinchen Hui
fd208e82dd Attempt to fix build reported fails in containers 2018-03-01 11:56:12 +08:00
Dmitry Stogov
285bfb96fe Optimize "backup" functions of inlined opcode handlers for size 2018-02-15 17:04:41 +03:00
Xinchen Hui
cf0fae5e97 Optimized base64_encode/decode with SIMD instructions 2018-02-12 20:53:14 +08:00
Anatol Belski
a06cde8236 If the target attribute is available, attach it explicitly
The ifunc attribute might be not available as it is binary format
dependent.
2018-02-03 17:18:41 +01:00
Anatol Belski
93185218e1 Revoke the gcc only restriction
clang at least 5.0 supports GNU style attributes and intrinsic macros.
In general, compilers claiming this functionality should know, what
they do.
2018-01-25 16:24:04 +01:00
Anatol Belski
92f9fde23a Macrify the common operation 2018-01-24 18:35:40 +01:00
Anatol Belski
7e2a9936d3 Move useful macro into zend_portability.h 2018-01-24 10:14:28 +01:00
Anatol Belski
a6e86f7a3f Implement intrinsic function resolving per MINIT 2018-01-24 09:33:32 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Nuno Lopes
f55083906f fix build with older gccs: label attributes are only available with gcc 5+ 2017-12-04 15:12:20 -05:00
Dmitry Stogov
6acfade8a1 Prefer "GNU asm goto" to __builtin_saddl_overflow() for overflow detection. This allows generation of significantly better code. 2017-11-28 12:37:00 +03:00
Nikita Popov
26f8fc833b Enable and fix printf() format warnings
Add _unchecked() variants of zend_spprintf and zend_strpprintf for
cases where we specifically want to disable these checks, such as
use of %H.
2017-11-16 21:15:36 +01:00
Sara Golemon
4a6ef8327a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Simpler fix for #74974
2017-07-27 10:04:59 -04:00
Sara Golemon
b62fb3aa0c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Simpler fix for #74974
2017-07-27 10:04:14 -04:00
Pedro Magalhães
34e5d3a87d Simpler fix for #74974 2017-07-27 09:25:38 -04:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Nikita Popov
205807f60e Move va_copy compatibility code into zend_portability.h
Previously this was defined in zend.c and php.h and also handled
in another way in soap.c.
2017-06-25 17:00:26 +02:00
Nikita Popov
f3d058c1da Merge branch 'PHP-7.1' 2017-02-16 17:36:09 +01:00
Nikita Popov
9ca43b873a Merge branch 'PHP-7.0' into PHP-7.1 2017-02-16 17:36:03 +01:00