build/autoconf/gcc-pr49911.m4

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 dnl This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 dnl Check if the compiler is gcc and has PR49911. If so
michael@0 6 dnl disable vrp.
michael@0 7
michael@0 8 AC_DEFUN([MOZ_GCC_PR49911],
michael@0 9 [
michael@0 10 if test "$GNU_CC"; then
michael@0 11
michael@0 12 AC_MSG_CHECKING(for gcc PR49911)
michael@0 13 ac_have_gcc_pr49911="no"
michael@0 14 AC_LANG_SAVE
michael@0 15 AC_LANG_CPLUSPLUS
michael@0 16
michael@0 17 _SAVE_CXXFLAGS=$CXXFLAGS
michael@0 18 CXXFLAGS="-O2"
michael@0 19 AC_TRY_RUN([
michael@0 20 extern "C" void abort(void);
michael@0 21 typedef enum {
michael@0 22 eax, ecx, edx, ebx, esp, ebp,
michael@0 23 esi, edi }
michael@0 24 RegisterID;
michael@0 25 union StateRemat {
michael@0 26 RegisterID reg_;
michael@0 27 int offset_;
michael@0 28 };
michael@0 29 static StateRemat FromRegister(RegisterID reg) {
michael@0 30 StateRemat sr;
michael@0 31 sr.reg_ = reg;
michael@0 32 return sr;
michael@0 33 }
michael@0 34 static StateRemat FromAddress3(int address) {
michael@0 35 StateRemat sr;
michael@0 36 sr.offset_ = address;
michael@0 37 if (address < 46 && address >= 0) {
michael@0 38 abort();
michael@0 39 }
michael@0 40 return sr;
michael@0 41 }
michael@0 42 struct FrameState {
michael@0 43 StateRemat dataRematInfo2(bool y, int z) {
michael@0 44 if (y) return FromRegister(RegisterID(1));
michael@0 45 return FromAddress3(z);
michael@0 46 }
michael@0 47 };
michael@0 48 FrameState frame;
michael@0 49 StateRemat x;
michael@0 50 __attribute__((noinline)) void jsop_setelem(bool y, int z) {
michael@0 51 x = frame.dataRematInfo2(y, z);
michael@0 52 }
michael@0 53 int main(void) {
michael@0 54 jsop_setelem(0, 47);
michael@0 55 }
michael@0 56 ], true,
michael@0 57 ac_have_gcc_pr49911="yes",
michael@0 58 true)
michael@0 59 CXXFLAGS="$_SAVE_CXXFLAGS"
michael@0 60
michael@0 61 AC_LANG_RESTORE
michael@0 62
michael@0 63 if test "$ac_have_gcc_pr49911" = "yes"; then
michael@0 64 AC_MSG_RESULT(yes)
michael@0 65 CFLAGS="$CFLAGS -fno-tree-vrp"
michael@0 66 CXXFLAGS="$CXXFLAGS -fno-tree-vrp"
michael@0 67 else
michael@0 68 AC_MSG_RESULT(no)
michael@0 69 fi
michael@0 70 fi
michael@0 71 ])

mercurial