We'd like to start using ##mixed## instead of ##var## for attribute types to be consistent with Hack. As a followup to this (once released), we would codemod all ##var## to ##mixed##.
C++11 cleanup (clean up easy enums)
This is for runtime/base/... and ended up touching a lot of files
because it turns out we have a lot of reasonably behaved enums.
More changes for HPHP to help make it clang friendly
~~~hphp/compiler/expression/constant_expression.h
~~~hphp/compiler/expression/function_call.h
rfind returns a size_t/unsigned int
~~~hphp/runtime/base/server/http_protocol.cpp
Switched to std::to_string. Assuming [] was not intended here
~~~hphp/runtime/base/ref_data.h
These fields were accessed in a public manner, assuming public was intended
instead of private
~~~hphp/runtime/base/variable_serializer.cpp
Switched to using [] and & to make clang happy. Assuming this was to either
take or drop the first char.
~~~hphp/runtime/ext/asio/asio_external_thread_event_queue.h
~~~hphp/runtime/ext/asio/asio_external_thread_event_queue.cpp
Cast which performs the conversions of a reinterpret_cast is not
allowed in a constant expression. This is been moved to a macro as a temporary
fix.
+++hphp/runtime/ext/ext_misc.cpp
Added std::atomic to supress warnings
~~~hphp/runtime/vm/jit/simplifier.cpp
Chosen constructor is explicit in copy-initialization
~~~hphp/runtime/vm/jit/translator-asm-helpers.S
Ambiguous instructions require an explicit suffix
Changed cmp to cmpl
~~~hphp/runtime/vm/jit/translator-x64-helpers.cpp
Clang does not support global register variables
+++hphp/runtime/vm/unwind.cpp
describeFault was only used when DEBUG or USE_TRACE was defined
~~~hphp/runtime/vm/verifier/check_unit.cpp
Made fmt pointer const to avoid string format issues/warnings
~~~hphp/util/stack_trace.cpp
Clang does not support variable-length arrays.
Uniqe_ptr is used instead to take advantage runtime-sized arrays, a
restriced form of variable-length arrays
~~~hphp/util/thread_local.h
Clang seems to be supporting the __thread attribute, or at the very least
it is not complaining about it.
~~~hphp/util/tiny_vector.h
Clang does not like the flexible array here, since T is not always POD.
I have reimplemented the array here by just sticking one value in the struct
and calculating the offset from its address manually.
Alterinatively, we could change the the non-POD types to be pointers, or
we could edit their implemenations.
+++hphp/util/util.h
Created a template for the union,
A function declared with the constexpr specifier cannot contain
type declarations that do not define classes or enumerations
+++hphp/runtime/vm/jit/x64-util.h
Added a TODO
The way hphp/runtime/vm/jit/x64-util.h is currently implemented, it only
works if USE_GCC_FAST_TLS is defined
This stuff almost is an abstraction layer, but it's in a
strange place. Also, the layout of TypedValue isn't something we've
been using through an abstraction layer, and if we want to later I
think we won't want to do so using this one.
DebuggerDump did not separate object properties with new lines. Now that it is used for cases with PrintR was previously used, the new behavior should be to insert the new lines.
The proximal purpose of this differential is to fix the debugger client so that it does not write raw strings to the console (with control characters doing their thing to the console and unprintable characters pretending not to exist). This change in behavior means that the serializer used to convert values to strings can no longer be instantiated with the PrintR option, as it has been in a subset of cases. (The reason being that print_r() must not change its behavior.)
Rather than introduce yet another serializer option, I decided to always make the debugger client serialize user visible values using the existing DebuggerDump option, which is already used in a number of such cases and which has no other use. To make the overall change less painful for users, I preferred to change behavior of DebuggerDump to be more like PrintR in a number of cases, primarily the formatting of objects (where the current behavior is to make a JSON like string).
This does not impact the behavior of the debugger client API or the behavior of FBIDE, since these do their own thing directly with the DebuggerSerialization format and never see the result of the DebuggerDump format.
I was learning from @jdelong and he said that you should use
double quotes for local includes and angle brackets for library
includes. I asked why our code was the way it was, and he said he wanted
to clean it up. I beat him to it :)
Conflicts:
hphp/runtime/base/server/admin_request_handler.cpp
hphp/runtime/vm/named_entity.h
The current output of var_export for collections isn't very useful. It
outputs a call to __set_state like so:
Map::__set_state(array(..))
This isn't particularly useful since collections don't implement the
__set_state() method, and it is also suboptimal for the design of
collections since it relies on using PHP arrays.
This diff changes var_export to use collection literal syntax for
collections instead of generating a call to __set_state().
The 'r' encoding for unserialization was broken for collections because the
code was calling Variant::unserialize() on a temporary Variant, which is a
no-no. unserialize() must be called directly on the value where it resides
in the collection.
Second, there was an inconsistency between serialize and unserialize with
how id numbers worked for the 'r' and 'R' encodings. This diff fixes
serialize and unserialize to count collection keys when assigning id
numbers. I also took the opportunity to tighten up enforcement to prevent
collections keys and values from being taken by reference when during
unserialization.
Replace "collection" with "collections" in various file names since
we typically use the plural form in conversation and documentation.
Add set() and removeAt() methods needed for collection interfaces. Also
add the KeyedIterable and KeyedIterator interfaces.
Add __construct() methods for collections
This change is mostly for FB internal organizational reasons.
Building is not effected beyond the fact that the target now
lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.