Support comparing Datums against Atoms.

Support comparing Datums against Atoms.

--- src/hexutil/basics/datum.h
+++ src/hexutil/basics/datum.h
@@ -8,6 +8,7 @@
 struct Datum {
     Datum(): value(0) { }
     Datum(int x): value(x) { }
+    Datum(const std::string& x): value(x) { }

     boost::variant<Atom, int, float, std::string> value;

@@ -17,6 +18,9 @@
     }

     bool operator==(const Datum& x) const { return value == x.value; }
+
+    Datum& operator=(const Atom& x) { value = x; return *this; }
+    bool operator==(const Atom& x) const { return boost::get<Atom>(value) == x; }

     Datum& operator=(const int& x) { value = x; return *this; }
     bool operator==(const int& x) const { return boost::get<int>(value) == x; }

<|original_code|>
#ifndef DATUM_H
#define DATUM_H

#include "hexutil/basics/atom.h"

// The variant must be wrapped like this, otherwise the compiler will get confused about which overload to use
struct Datum {
    Datum(): value(0) { }
    Datum(int x): value(x) { }

    boost::variant<Atom, int, float, std::string> value;

    Datum& operator=(const Datum& x) {
        value = x.value;
        return *this;
    }

    bool operator==(const Datum& x) const { return value == x.value; }

    Datum& operator=(const int& x) { value = x; return *this; }
    bool operator==(const int& x) const { return boost::get<int>(value) == x; }

    template<typename T>
    operator T() const { return boost::get<T>(value); }

    template<typename T>
    bool is() const {
        return boost::get<T>(&value) != nullptr;
    }

    template<typename T>
    const T& get() const {
        return boost::get<T>(value);
    }

    std::string get_as_str() const;
    Atom get_as_atom() const;
    int get_as_int() const;
};

std::ostream& operator<<(std::ostream& os, const Datum& atom);

#endif

<|edits_diff|>
--- src/hexutil/basics/datum.h
+++ src/hexutil/basics/datum.h
@@ -8,6 +8,7 @@
 struct Datum {
     Datum(): value(0) { }
     Datum(int x): value(x) { }
+    Datum(const std::string& x): value(x) { }

     boost::variant<Atom, int, float, std::string> value;

<|current_version|>
#ifndef DATUM_H
#define DATUM_H

#include "hexutil/basics/atom.h"

// The variant must be wrapped like this, otherwise the compiler will get confused about which overload to use
struct Datum {
    Datum(): value(0) { }
    Datum(int x): value(x) { }
    Datum(const std::string& x): value(x) { }

    boost::variant<Atom, int, float, std::string> value;

    Datum& operator=(const Datum& x) {
        value = x.value;
        return *this;
    }

    bool operator==(const Datum& x) const { return value == x.value; }

    Datum& operator=(const int& x) { value = x; return *this; }
    bool operator==(const int& x) const { return boost::get<int>(value) == x; }

    template<typename T>
    operator T() const { return boost::get<T>(value); }

    template<typename T>
    bool is() const {
        return boost::get<T>(&value) != nullptr;
    }

    template<typename T>
    const T& get() const {
        return boost::get<T>(value);
    }

    std::string get_as_str() const;
    Atom get_as_atom() const;
    int get_as_int() const;
};

std::ostream& operator<<(std::ostream& os, const Datum& atom);

#endif

<|next_version|>
#ifndef DATUM_H
#define DATUM_H

#include "hexutil/basics/atom.h"

// The variant must be wrapped like this, otherwise the compiler will get confused about which overload to use
struct Datum {
    Datum(): value(0) { }
    Datum(int x): value(x) { }
    Datum(const std::string& x): value(x) { }

    boost::variant<Atom, int, float, std::string> value;

    Datum& operator=(const Datum& x) {
        value = x.value;
        return *this;
    }

    bool operator==(const Datum& x) const { return value == x.value; }

    Datum& operator=(const Atom& x) { value = x; return *this; }
    bool operator==(const Atom& x) const { return boost::get<Atom>(value) == x; }

    Datum& operator=(const int& x) { value = x; return *this; }
    bool operator==(const int& x) const { return boost::get<int>(value) == x; }

    template<typename T>
    operator T() const { return boost::get<T>(value); }

    template<typename T>
    bool is() const {
        return boost::get<T>(&value) != nullptr;
    }

    template<typename T>
    const T& get() const {
        return boost::get<T>(value);
    }

    std::string get_as_str() const;
    Atom get_as_atom() const;
    int get_as_int() const;
};

std::ostream& operator<<(std::ostream& os, const Datum& atom);

#endif


Fix compile error on Leopard & Tiger.

Fix compile error on Leopard & Tiger.

--- src/GtkApplicationDelegate.h
+++ src/GtkApplicationDelegate.h
@@ -21,7 +21,12 @@
  */

 #import <Cocoa/Cocoa.h>
+#include <AvailabilityMacros.h>

+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 @interface GtkApplicationDelegate : NSObject <NSApplicationDelegate> {}
+#else
+@interface GtkApplicationDelegate : NSObject {}
+#endif
 @end

<|original_code|>
/* GTK+ Integration with platform-specific application-wide features
 * such as the OS X menubar and application delegate concepts.
 *
 * Copyright (C) 2009 Paul Davis
 * Copyright © 2010 John Ralls
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; version 2.1
 * of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#import <Cocoa/Cocoa.h>

@interface GtkApplicationDelegate : NSObject <NSApplicationDelegate> {}
@end

<|edits_diff|>
--- src/GtkApplicationDelegate.h
+++ src/GtkApplicationDelegate.h
@@ -21,7 +21,9 @@
  */

 #import <Cocoa/Cocoa.h>
+#include <AvailabilityMacros.h>

+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 @interface GtkApplicationDelegate : NSObject <NSApplicationDelegate> {}
 @end

<|current_version|>
/* GTK+ Integration with platform-specific application-wide features
 * such as the OS X menubar and application delegate concepts.
 *
 * Copyright (C) 2009 Paul Davis
 * Copyright © 2010 John Ralls
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; version 2.1
 * of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#import <Cocoa/Cocoa.h>
#include <AvailabilityMacros.h>

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
@interface GtkApplicationDelegate : NSObject <NSApplicationDelegate> {}
@end

<|next_version|>
/* GTK+ Integration with platform-specific application-wide features
 * such as the OS X menubar and application delegate concepts.
 *
 * Copyright (C) 2009 Paul Davis
 * Copyright © 2010 John Ralls
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; version 2.1
 * of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#import <Cocoa/Cocoa.h>
#include <AvailabilityMacros.h>

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
@interface GtkApplicationDelegate : NSObject <NSApplicationDelegate> {}
#else
@interface GtkApplicationDelegate : NSObject {}
#endif
@end


Fix public header for macOS

Fix public header for macOS

--- lottie-ios/Classes/PublicHeaders/Lottie.h
+++ lottie-ios/Classes/PublicHeaders/Lottie.h
@@ -21,7 +21,12 @@
 //! Project version string for Lottie.
 FOUNDATION_EXPORT const unsigned char LottieVersionString[];

+#include <TargetConditionals.h>
+
+#if TARGET_OS_IPHONE
 #import "LOTAnimationTransitionController.h"
+#endif
+
 #import "LOTAnimationView.h"

 #endif /* Lottie_h */

<|original_code|>
//
//  Lottie.h
//  Pods
//
//  Created by brandon_withrow on 1/27/17.
//
//

#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif

#ifndef Lottie_h
#define Lottie_h

//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;

//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];

#import "LOTAnimationTransitionController.h"
#import "LOTAnimationView.h"

#endif /* Lottie_h */

<|edits_diff|>
--- lottie-ios/Classes/PublicHeaders/Lottie.h
+++ lottie-ios/Classes/PublicHeaders/Lottie.h
@@ -21,6 +21,9 @@
 //! Project version string for Lottie.
 FOUNDATION_EXPORT const unsigned char LottieVersionString[];

+#include <TargetConditionals.h>
+
+#if TARGET_OS_IPHONE
 #import "LOTAnimationTransitionController.h"
 #import "LOTAnimationView.h"

<|current_version|>
//
//  Lottie.h
//  Pods
//
//  Created by brandon_withrow on 1/27/17.
//
//

#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif

#ifndef Lottie_h
#define Lottie_h

//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;

//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];

#include <TargetConditionals.h>

#if TARGET_OS_IPHONE
#import "LOTAnimationTransitionController.h"
#import "LOTAnimationView.h"

#endif /* Lottie_h */

<|next_version|>
//
//  Lottie.h
//  Pods
//
//  Created by brandon_withrow on 1/27/17.
//
//

#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif

#ifndef Lottie_h
#define Lottie_h

//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;

//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];

#include <TargetConditionals.h>

#if TARGET_OS_IPHONE
#import "LOTAnimationTransitionController.h"
#endif

#import "LOTAnimationView.h"

#endif /* Lottie_h */


Add message when tests are finished.

tests/libfixmath_unittests: Add message when tests are finished.

--- tests/libfixmath_unittests/main.c
+++ tests/libfixmath_unittests/main.c
@@ -28,9 +28,12 @@
  * @}
  */

+#include <stdio.h>
+
 int main(void)
 {
 #include "fix16_unittests.inc"

+    puts("All tests executed.");
     return 0;
 }

<|original_code|>
/*
 * Copyright (C) 2014  René Kijewski  <rene.kijewski@fu-berlin.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

/**
 * @ingroup   tests
 * @{
 *
 * @file
 * @brief     execute libfixmath's unittests in RIOT
 *
 * @author    René Kijewski <rene.kijewski@fu-berlin.de>
 *
 * @}
 */

int main(void)
{
#include "fix16_unittests.inc"

    return 0;
}

<|edits_diff|>
--- tests/libfixmath_unittests/main.c
+++ tests/libfixmath_unittests/main.c
@@ -28,6 +28,8 @@
  * @}
  */

+#include <stdio.h>
+
 int main(void)
 {
 #include "fix16_unittests.inc"
<|current_version|>
/*
 * Copyright (C) 2014  René Kijewski  <rene.kijewski@fu-berlin.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

/**
 * @ingroup   tests
 * @{
 *
 * @file
 * @brief     execute libfixmath's unittests in RIOT
 *
 * @author    René Kijewski <rene.kijewski@fu-berlin.de>
 *
 * @}
 */

#include <stdio.h>

int main(void)
{
#include "fix16_unittests.inc"

    return 0;
}

<|next_version|>
/*
 * Copyright (C) 2014  René Kijewski  <rene.kijewski@fu-berlin.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

/**
 * @ingroup   tests
 * @{
 *
 * @file
 * @brief     execute libfixmath's unittests in RIOT
 *
 * @author    René Kijewski <rene.kijewski@fu-berlin.de>
 *
 * @}
 */

#include <stdio.h>

int main(void)
{
#include "fix16_unittests.inc"

    puts("All tests executed.");
    return 0;
}


Allow to build with clang-cl

Allow to build with clang-cl

--- include/msvc_compat/C99/stdbool.h
+++ include/msvc_compat/C99/stdbool.h
@@ -5,7 +5,11 @@

 /* MSVC doesn't define _Bool or bool in C, but does have BOOL */
 /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
+/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
+ * a built-in type. */
+#ifndef __clang__
 typedef BOOL _Bool;
+#endif

 #define bool _Bool
 #define true 1

<|original_code|>
#ifndef stdbool_h
#define stdbool_h

#include <wtypes.h>

/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
typedef BOOL _Bool;

#define bool _Bool
#define true 1
#define false 0

#define __bool_true_false_are_defined 1

#endif /* stdbool_h */

<|edits_diff|>
--- include/msvc_compat/C99/stdbool.h
+++ include/msvc_compat/C99/stdbool.h
@@ -5,6 +5,9 @@

 /* MSVC doesn't define _Bool or bool in C, but does have BOOL */
 /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
+/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
+ * a built-in type. */
+#ifndef __clang__
 typedef BOOL _Bool;

 #define bool _Bool
<|current_version|>
#ifndef stdbool_h
#define stdbool_h

#include <wtypes.h>

/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
 * a built-in type. */
#ifndef __clang__
typedef BOOL _Bool;

#define bool _Bool
#define true 1
#define false 0

#define __bool_true_false_are_defined 1

#endif /* stdbool_h */

<|next_version|>
#ifndef stdbool_h
#define stdbool_h

#include <wtypes.h>

/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
 * a built-in type. */
#ifndef __clang__
typedef BOOL _Bool;
#endif

#define bool _Bool
#define true 1
#define false 0

#define __bool_true_false_are_defined 1

#endif /* stdbool_h */


Fix headers so SNTP builds on Esp32

Fix headers so SNTP builds on Esp32

--- src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h
+++ src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h
@@ -15,7 +15,11 @@

 extern "C"
 {
+#ifndef PLATFORM_ESP32
 #include <apps/sntp.h>
+#else
+#include <apps/sntp/sntp.h>
+#endif
 }

 struct Library_nf_networking_sntp_nanoFramework_Networking_Sntp

<|original_code|>
//
// Copyright (c) 2018 The nanoFramework project contributors
// Portions Copyright (c) Microsoft Corporation.  All rights reserved.
// See LICENSE file in the project root for full license information.
//

#ifndef _NF_NETWORKING_SNTP_H_
#define _NF_NETWORKING_SNTP_H_

#include <nanoCLR_Interop.h>
#include <nanoCLR_Runtime.h>
#include <nanoCLR_Checks.h>
#include <nanoHAL_time.h>

extern "C"
{
#include <apps/sntp.h>
}

struct Library_nf_networking_sntp_nanoFramework_Networking_Sntp
{
    NANOCLR_NATIVE_DECLARE(Start___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(Stop___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(UpdateNow___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(get_IsStarted___STATIC__BOOLEAN);
    NANOCLR_NATIVE_DECLARE(get_Server1___STATIC__STRING);
    NANOCLR_NATIVE_DECLARE(set_Server1___STATIC__VOID__STRING);
    NANOCLR_NATIVE_DECLARE(get_Server2___STATIC__STRING);
    NANOCLR_NATIVE_DECLARE(set_Server2___STATIC__VOID__STRING);

    //--//

};

extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Networking_Sntp;

#endif  //_NF_NETWORKING_SNTP_H_

<|edits_diff|>
--- src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h
+++ src/DeviceInterfaces/Networking.Sntp/nf_networking_sntp.h
@@ -15,6 +15,7 @@

 extern "C"
 {
+#ifndef PLATFORM_ESP32
 #include <apps/sntp.h>
 }

<|current_version|>
//
// Copyright (c) 2018 The nanoFramework project contributors
// Portions Copyright (c) Microsoft Corporation.  All rights reserved.
// See LICENSE file in the project root for full license information.
//

#ifndef _NF_NETWORKING_SNTP_H_
#define _NF_NETWORKING_SNTP_H_

#include <nanoCLR_Interop.h>
#include <nanoCLR_Runtime.h>
#include <nanoCLR_Checks.h>
#include <nanoHAL_time.h>

extern "C"
{
#ifndef PLATFORM_ESP32
#include <apps/sntp.h>
}

struct Library_nf_networking_sntp_nanoFramework_Networking_Sntp
{
    NANOCLR_NATIVE_DECLARE(Start___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(Stop___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(UpdateNow___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(get_IsStarted___STATIC__BOOLEAN);
    NANOCLR_NATIVE_DECLARE(get_Server1___STATIC__STRING);
    NANOCLR_NATIVE_DECLARE(set_Server1___STATIC__VOID__STRING);
    NANOCLR_NATIVE_DECLARE(get_Server2___STATIC__STRING);
    NANOCLR_NATIVE_DECLARE(set_Server2___STATIC__VOID__STRING);

    //--//

};

extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Networking_Sntp;

#endif  //_NF_NETWORKING_SNTP_H_

<|next_version|>
//
// Copyright (c) 2018 The nanoFramework project contributors
// Portions Copyright (c) Microsoft Corporation.  All rights reserved.
// See LICENSE file in the project root for full license information.
//

#ifndef _NF_NETWORKING_SNTP_H_
#define _NF_NETWORKING_SNTP_H_

#include <nanoCLR_Interop.h>
#include <nanoCLR_Runtime.h>
#include <nanoCLR_Checks.h>
#include <nanoHAL_time.h>

extern "C"
{
#ifndef PLATFORM_ESP32
#include <apps/sntp.h>
#else
#include <apps/sntp/sntp.h>
#endif
}

struct Library_nf_networking_sntp_nanoFramework_Networking_Sntp
{
    NANOCLR_NATIVE_DECLARE(Start___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(Stop___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(UpdateNow___STATIC__VOID);
    NANOCLR_NATIVE_DECLARE(get_IsStarted___STATIC__BOOLEAN);
    NANOCLR_NATIVE_DECLARE(get_Server1___STATIC__STRING);
    NANOCLR_NATIVE_DECLARE(set_Server1___STATIC__VOID__STRING);
    NANOCLR_NATIVE_DECLARE(get_Server2___STATIC__STRING);
    NANOCLR_NATIVE_DECLARE(set_Server2___STATIC__VOID__STRING);

    //--//

};

extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Networking_Sntp;

#endif  //_NF_NETWORKING_SNTP_H_


Add more methods to be more value-like

Add more methods to be more value-like

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@8074 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/Support/ValueHolder.h
+++ include/llvm/Support/ValueHolder.h
@@ -15,6 +15,7 @@

 struct ValueHolder : public User {
   ValueHolder(Value *V = 0);
+  ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {}

   // Getters...
   const Value *get() const { return getOperand(0); }
@@ -28,6 +29,11 @@
     return *this;
   }

+  const ValueHolder &operator=(ValueHolder &VH) {
+    setOperand(0, VH);
+    return *this;
+  }
+
   virtual void print(std::ostream& OS) const {
     OS << "ValueHolder";
   }

<|original_code|>
//===-- llvm/Support/ValueHolder.h - Wrapper for Value's --------*- C++ -*-===//
//
// This class defines a simple subclass of User, which keeps a pointer to a
// Value, which automatically updates when Value::replaceAllUsesWith is called.
// This is useful when you have pointers to Value's in your pass, but the
// pointers get invalidated when some other portion of the algorithm is
// replacing Values with other Values.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_VALUEHOLDER_H
#define LLVM_SUPPORT_VALUEHOLDER_H

#include "llvm/User.h"

struct ValueHolder : public User {
  ValueHolder(Value *V = 0);

  // Getters...
  const Value *get() const { return getOperand(0); }
  operator const Value*() const { return getOperand(0); }
  Value *get() { return getOperand(0); }
  operator Value*() { return getOperand(0); }

  // Setters...
  const ValueHolder &operator=(Value *V) {
    setOperand(0, V);
    return *this;
  }

  virtual void print(std::ostream& OS) const {
    OS << "ValueHolder";
  }
};

#endif

<|edits_diff|>
--- include/llvm/Support/ValueHolder.h
+++ include/llvm/Support/ValueHolder.h
@@ -15,6 +15,7 @@

 struct ValueHolder : public User {
   ValueHolder(Value *V = 0);
+  ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {}

   // Getters...
   const Value *get() const { return getOperand(0); }
<|current_version|>
//===-- llvm/Support/ValueHolder.h - Wrapper for Value's --------*- C++ -*-===//
//
// This class defines a simple subclass of User, which keeps a pointer to a
// Value, which automatically updates when Value::replaceAllUsesWith is called.
// This is useful when you have pointers to Value's in your pass, but the
// pointers get invalidated when some other portion of the algorithm is
// replacing Values with other Values.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_VALUEHOLDER_H
#define LLVM_SUPPORT_VALUEHOLDER_H

#include "llvm/User.h"

struct ValueHolder : public User {
  ValueHolder(Value *V = 0);
  ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {}

  // Getters...
  const Value *get() const { return getOperand(0); }
  operator const Value*() const { return getOperand(0); }
  Value *get() { return getOperand(0); }
  operator Value*() { return getOperand(0); }

  // Setters...
  const ValueHolder &operator=(Value *V) {
    setOperand(0, V);
    return *this;
  }

  virtual void print(std::ostream& OS) const {
    OS << "ValueHolder";
  }
};

#endif

<|next_version|>
//===-- llvm/Support/ValueHolder.h - Wrapper for Value's --------*- C++ -*-===//
//
// This class defines a simple subclass of User, which keeps a pointer to a
// Value, which automatically updates when Value::replaceAllUsesWith is called.
// This is useful when you have pointers to Value's in your pass, but the
// pointers get invalidated when some other portion of the algorithm is
// replacing Values with other Values.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_VALUEHOLDER_H
#define LLVM_SUPPORT_VALUEHOLDER_H

#include "llvm/User.h"

struct ValueHolder : public User {
  ValueHolder(Value *V = 0);
  ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {}

  // Getters...
  const Value *get() const { return getOperand(0); }
  operator const Value*() const { return getOperand(0); }
  Value *get() { return getOperand(0); }
  operator Value*() { return getOperand(0); }

  // Setters...
  const ValueHolder &operator=(Value *V) {
    setOperand(0, V);
    return *this;
  }

  const ValueHolder &operator=(ValueHolder &VH) {
    setOperand(0, VH);
    return *this;
  }

  virtual void print(std::ostream& OS) const {
    OS << "ValueHolder";
  }
};

#endif


Disable GL sizes PPAPI tests

Disable GL sizes PPAPI tests

The wrong size is defined for Win64. It needs a real fix, but first I need to unblock the builder.

BUG=177779

Review URL: https://chromiumcodereview.appspot.com/12310080

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@184296 0039d316-1c4b-4281-b951-d872f2087c98

--- ppapi/tests/arch_dependent_sizes_64.h
+++ ppapi/tests/arch_dependent_sizes_64.h
@@ -11,8 +11,11 @@

 #include "ppapi/tests/test_struct_sizes.c"

+// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
+#if !defined(_WIN64)
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
+#endif
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);

<|original_code|>
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * This file has compile assertions for the sizes of types that are dependent
 * on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
 */

#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_

#include "ppapi/tests/test_struct_sizes.c"

PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);

#endif  /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */

<|edits_diff|>
--- ppapi/tests/arch_dependent_sizes_64.h
+++ ppapi/tests/arch_dependent_sizes_64.h
@@ -11,6 +11,8 @@

 #include "ppapi/tests/test_struct_sizes.c"

+// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
+#if !defined(_WIN64)
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
<|current_version|>
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * This file has compile assertions for the sizes of types that are dependent
 * on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
 */

#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_

#include "ppapi/tests/test_struct_sizes.c"

// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
#if !defined(_WIN64)
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);

#endif  /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */

<|next_version|>
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * This file has compile assertions for the sizes of types that are dependent
 * on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
 */

#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_

#include "ppapi/tests/test_struct_sizes.c"

// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
#if !defined(_WIN64)
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
#endif
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);

#endif  /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */


firmware/lm32: Make 800x600 the default mode for the minispartan6+

--- firmware/lm32/config.h
+++ firmware/lm32/config.h
@@ -11,7 +11,11 @@
 	CONFIG_KEY_COUNT
 };

+#ifdef BOARD_MINISPARTAN6
+#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 }
+#else
 #define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }
+#endif

 void config_init(void);
 void config_write_all(void);

<|original_code|>
#ifndef __CONFIG_H
#define __CONFIG_H

enum {
	CONFIG_KEY_RESOLUTION = 0,
	CONFIG_KEY_BLEND_USER1,
	CONFIG_KEY_BLEND_USER2,
	CONFIG_KEY_BLEND_USER3,
	CONFIG_KEY_BLEND_USER4,

	CONFIG_KEY_COUNT
};

#define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }

void config_init(void);
void config_write_all(void);
unsigned char config_get(unsigned char key);
void config_set(unsigned char key, unsigned char value);

#endif /* __CONFIG_H */

<|edits_diff|>
--- firmware/lm32/config.h
+++ firmware/lm32/config.h
@@ -11,6 +11,9 @@
 	CONFIG_KEY_COUNT
 };

+#ifdef BOARD_MINISPARTAN6
+#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 }
+#else
 #define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }

 void config_init(void);
<|current_version|>
#ifndef __CONFIG_H
#define __CONFIG_H

enum {
	CONFIG_KEY_RESOLUTION = 0,
	CONFIG_KEY_BLEND_USER1,
	CONFIG_KEY_BLEND_USER2,
	CONFIG_KEY_BLEND_USER3,
	CONFIG_KEY_BLEND_USER4,

	CONFIG_KEY_COUNT
};

#ifdef BOARD_MINISPARTAN6
#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 }
#else
#define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }

void config_init(void);
void config_write_all(void);
unsigned char config_get(unsigned char key);
void config_set(unsigned char key, unsigned char value);

#endif /* __CONFIG_H */

<|next_version|>
#ifndef __CONFIG_H
#define __CONFIG_H

enum {
	CONFIG_KEY_RESOLUTION = 0,
	CONFIG_KEY_BLEND_USER1,
	CONFIG_KEY_BLEND_USER2,
	CONFIG_KEY_BLEND_USER3,
	CONFIG_KEY_BLEND_USER4,

	CONFIG_KEY_COUNT
};

#ifdef BOARD_MINISPARTAN6
#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 }
#else
#define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }
#endif

void config_init(void);
void config_write_all(void);
unsigned char config_get(unsigned char key);
void config_set(unsigned char key, unsigned char value);

#endif /* __CONFIG_H */


Prepare function added for Robot modules.

--- robot_module.h
+++ robot_module.h
@@ -10,6 +10,8 @@
 #define ROBOT_COMMAND_FREE 0
 #define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
 #define ROBOT_COMMAND_HAND_CONTROL_END -2
+
+typedef std::function<void(unsigned short int, const char*, va_list)> t_printf_color_module;

 class Robot {
     protected:
@@ -25,6 +27,7 @@
         RobotModule() {}
     public:
         virtual const char *getUID() = 0;
+        virtual void prepare(t_printf_color_module f_printf) = 0;
         virtual int init() = 0;
         virtual FunctionData** getFunctions(int *count_functions) = 0;
         virtual AxisData** getAxis(int *count_axis) = 0;

<|original_code|>
/*
 * File:   robots.h
 * Author: m79lol
 *
 */

#ifndef ROBOT_MODULE_H
#define	ROBOT_MODULE_H

#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2

class Robot {
    protected:
        Robot() {}
    public:
        virtual FunctionResult* executeFunction(regval command_index, regval *args) = 0;
        virtual void axisControl(regval axis_index, regval value) = 0;
        virtual ~Robot() {}
};

class RobotModule {
    protected:
        RobotModule() {}
    public:
        virtual const char *getUID() = 0;
        virtual int init() = 0;
        virtual FunctionData** getFunctions(int *count_functions) = 0;
        virtual AxisData** getAxis(int *count_axis) = 0;
        virtual Robot* robotRequire() = 0;
        virtual void robotFree(Robot *robot) = 0;
        virtual void final() = 0;
        virtual void destroy() = 0;
        virtual ~RobotModule() {}
};

typedef RobotModule* (*getRobotModuleObject_t)();
extern "C" {
    __declspec(dllexport) RobotModule* getRobotModuleObject();
}

#endif	/* ROBOT_MODULE_H */

<|edits_diff|>
--- robot_module.h
+++ robot_module.h
@@ -10,6 +10,8 @@
 #define ROBOT_COMMAND_FREE 0
 #define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
 #define ROBOT_COMMAND_HAND_CONTROL_END -2
+
+typedef std::function<void(unsigned short int, const char*, va_list)> t_printf_color_module;

 class Robot {
     protected:
<|current_version|>
/*
 * File:   robots.h
 * Author: m79lol
 *
 */

#ifndef ROBOT_MODULE_H
#define	ROBOT_MODULE_H

#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2

typedef std::function<void(unsigned short int, const char*, va_list)> t_printf_color_module;

class Robot {
    protected:
        Robot() {}
    public:
        virtual FunctionResult* executeFunction(regval command_index, regval *args) = 0;
        virtual void axisControl(regval axis_index, regval value) = 0;
        virtual ~Robot() {}
};

class RobotModule {
    protected:
        RobotModule() {}
    public:
        virtual const char *getUID() = 0;
        virtual int init() = 0;
        virtual FunctionData** getFunctions(int *count_functions) = 0;
        virtual AxisData** getAxis(int *count_axis) = 0;
        virtual Robot* robotRequire() = 0;
        virtual void robotFree(Robot *robot) = 0;
        virtual void final() = 0;
        virtual void destroy() = 0;
        virtual ~RobotModule() {}
};

typedef RobotModule* (*getRobotModuleObject_t)();
extern "C" {
    __declspec(dllexport) RobotModule* getRobotModuleObject();
}

#endif	/* ROBOT_MODULE_H */

<|next_version|>
/*
 * File:   robots.h
 * Author: m79lol
 *
 */

#ifndef ROBOT_MODULE_H
#define	ROBOT_MODULE_H

#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2

typedef std::function<void(unsigned short int, const char*, va_list)> t_printf_color_module;

class Robot {
    protected:
        Robot() {}
    public:
        virtual FunctionResult* executeFunction(regval command_index, regval *args) = 0;
        virtual void axisControl(regval axis_index, regval value) = 0;
        virtual ~Robot() {}
};

class RobotModule {
    protected:
        RobotModule() {}
    public:
        virtual const char *getUID() = 0;
        virtual void prepare(t_printf_color_module f_printf) = 0;
        virtual int init() = 0;
        virtual FunctionData** getFunctions(int *count_functions) = 0;
        virtual AxisData** getAxis(int *count_axis) = 0;
        virtual Robot* robotRequire() = 0;
        virtual void robotFree(Robot *robot) = 0;
        virtual void final() = 0;
        virtual void destroy() = 0;
        virtual ~RobotModule() {}
};

typedef RobotModule* (*getRobotModuleObject_t)();
extern "C" {
    __declspec(dllexport) RobotModule* getRobotModuleObject();
}

#endif	/* ROBOT_MODULE_H */


Make inclusion from C++ projects easier

Make inclusion from C++ projects easier

This code adds a conditional extern "C" statement - which most C libraries do as a courtesy for C++ users.

--- ipcrypt.h
+++ ipcrypt.h
@@ -4,6 +4,10 @@

 #define IPCRYPT_BYTES 4
 #define IPCRYPT_KEYBYTES 16
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                     const unsigned char in[IPCRYPT_BYTES],
@@ -12,4 +16,9 @@
 int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                     const unsigned char in[IPCRYPT_BYTES],
                     const unsigned char key[IPCRYPT_KEYBYTES]);
+
+#ifdef __cplusplus
+}  /* End of the 'extern "C"' block */
 #endif
+
+#endif

<|original_code|>

#ifndef ipcrypt_H
#define ipcrypt_H

#define IPCRYPT_BYTES 4
#define IPCRYPT_KEYBYTES 16

int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);
#endif

<|edits_diff|>
--- ipcrypt.h
+++ ipcrypt.h
@@ -4,6 +4,10 @@

 #define IPCRYPT_BYTES 4
 #define IPCRYPT_KEYBYTES 16
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                     const unsigned char in[IPCRYPT_BYTES],
@@ -12,4 +16,7 @@
 int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                     const unsigned char in[IPCRYPT_BYTES],
                     const unsigned char key[IPCRYPT_KEYBYTES]);
+
+#ifdef __cplusplus
+}  /* End of the 'extern "C"' block */
 #endif
<|current_version|>

#ifndef ipcrypt_H
#define ipcrypt_H

#define IPCRYPT_BYTES 4
#define IPCRYPT_KEYBYTES 16

#ifdef __cplusplus
extern "C" {
#endif

int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif

<|next_version|>

#ifndef ipcrypt_H
#define ipcrypt_H

#define IPCRYPT_BYTES 4
#define IPCRYPT_KEYBYTES 16

#ifdef __cplusplus
extern "C" {
#endif

int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif

#endif


brushlib/test: Add missing extern "C" declaration to header

--- tests/mypaint-test-surface.h
+++ tests/mypaint-test-surface.h
@@ -2,6 +2,9 @@
 #define MYPAINTTESTSURFACE_H

 #include <mypaint-surface.h>
+#include <mypaint-glib-compat.h>
+
+G_BEGIN_DECLS

 typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);

@@ -10,4 +13,6 @@
                       MyPaintTestsSurfaceFactory surface_factory,
                       gchar *title, gpointer user_data);

+G_END_DECLS
+
 #endif // MYPAINTTESTSURFACE_H

<|original_code|>
#ifndef MYPAINTTESTSURFACE_H
#define MYPAINTTESTSURFACE_H

#include <mypaint-surface.h>

typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);

int
mypaint_test_surface_run(int argc, char **argv,
                      MyPaintTestsSurfaceFactory surface_factory,
                      gchar *title, gpointer user_data);

#endif // MYPAINTTESTSURFACE_H

<|edits_diff|>
--- tests/mypaint-test-surface.h
+++ tests/mypaint-test-surface.h
@@ -2,6 +2,9 @@
 #define MYPAINTTESTSURFACE_H

 #include <mypaint-surface.h>
+#include <mypaint-glib-compat.h>
+
+G_BEGIN_DECLS

 typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);

<|current_version|>
#ifndef MYPAINTTESTSURFACE_H
#define MYPAINTTESTSURFACE_H

#include <mypaint-surface.h>
#include <mypaint-glib-compat.h>

G_BEGIN_DECLS

typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);

int
mypaint_test_surface_run(int argc, char **argv,
                      MyPaintTestsSurfaceFactory surface_factory,
                      gchar *title, gpointer user_data);

#endif // MYPAINTTESTSURFACE_H

<|next_version|>
#ifndef MYPAINTTESTSURFACE_H
#define MYPAINTTESTSURFACE_H

#include <mypaint-surface.h>
#include <mypaint-glib-compat.h>

G_BEGIN_DECLS

typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);

int
mypaint_test_surface_run(int argc, char **argv,
                      MyPaintTestsSurfaceFactory surface_factory,
                      gchar *title, gpointer user_data);

G_END_DECLS

#endif // MYPAINTTESTSURFACE_H


Put a lock around kalloc*

Put a lock around kalloc*

--- kernel/port/heap.c
+++ kernel/port/heap.c
@@ -3,6 +3,9 @@
 #include <kernel/port/units.h>
 #include <kernel/port/stdio.h>
 #include <kernel/port/panic.h>
+#include <kernel/arch/lock.h>
+
+static mutex_t heap_lock;

 /* round_up returns `n` rounded to the next value that is zero
  * modulo `align`. */
@@ -21,12 +24,14 @@
 }

 void *kalloc_align(uintptr_t size, uintptr_t alignment) {
+	wait_acquire(&heap_lock);
 	heap_next = round_up(heap_next, alignment);
 	uintptr_t ret = heap_next;
 	heap_next += size;
 	if(heap_next > heap_end) {
 		panic("Out of space!");
 	}
+	release(&heap_lock);
 	return (void*)ret;
 }

<|original_code|>
#include <stddef.h>
#include <kernel/port/heap.h>
#include <kernel/port/units.h>
#include <kernel/port/stdio.h>
#include <kernel/port/panic.h>

/* round_up returns `n` rounded to the next value that is zero
 * modulo `align`. */
static uintptr_t round_up(uintptr_t n, uintptr_t align) {
	if (n % align) {
		return n + (align - (n % align));
	}
	return n;
}

uintptr_t heap_next, heap_end;

void heap_init(uintptr_t start, uintptr_t end) {
	heap_next = start;
	heap_end = end;
}

void *kalloc_align(uintptr_t size, uintptr_t alignment) {
	heap_next = round_up(heap_next, alignment);
	uintptr_t ret = heap_next;
	heap_next += size;
	if(heap_next > heap_end) {
		panic("Out of space!");
	}
	return (void*)ret;
}

void *kalloc(uintptr_t size) {
	return kalloc_align(size, sizeof(uintptr_t));
}

void kfree(void *ptr, uintptr_t size) {
}

<|edits_diff|>
--- kernel/port/heap.c
+++ kernel/port/heap.c
@@ -3,6 +3,9 @@
 #include <kernel/port/units.h>
 #include <kernel/port/stdio.h>
 #include <kernel/port/panic.h>
+#include <kernel/arch/lock.h>
+
+static mutex_t heap_lock;

 /* round_up returns `n` rounded to the next value that is zero
  * modulo `align`. */
@@ -21,6 +24,7 @@
 }

 void *kalloc_align(uintptr_t size, uintptr_t alignment) {
+	wait_acquire(&heap_lock);
 	heap_next = round_up(heap_next, alignment);
 	uintptr_t ret = heap_next;
 	heap_next += size;
<|current_version|>
#include <stddef.h>
#include <kernel/port/heap.h>
#include <kernel/port/units.h>
#include <kernel/port/stdio.h>
#include <kernel/port/panic.h>
#include <kernel/arch/lock.h>

static mutex_t heap_lock;

/* round_up returns `n` rounded to the next value that is zero
 * modulo `align`. */
static uintptr_t round_up(uintptr_t n, uintptr_t align) {
	if (n % align) {
		return n + (align - (n % align));
	}
	return n;
}

uintptr_t heap_next, heap_end;

void heap_init(uintptr_t start, uintptr_t end) {
	heap_next = start;
	heap_end = end;
}

void *kalloc_align(uintptr_t size, uintptr_t alignment) {
	wait_acquire(&heap_lock);
	heap_next = round_up(heap_next, alignment);
	uintptr_t ret = heap_next;
	heap_next += size;
	if(heap_next > heap_end) {
		panic("Out of space!");
	}
	return (void*)ret;
}

void *kalloc(uintptr_t size) {
	return kalloc_align(size, sizeof(uintptr_t));
}

void kfree(void *ptr, uintptr_t size) {
}

<|next_version|>
#include <stddef.h>
#include <kernel/port/heap.h>
#include <kernel/port/units.h>
#include <kernel/port/stdio.h>
#include <kernel/port/panic.h>
#include <kernel/arch/lock.h>

static mutex_t heap_lock;

/* round_up returns `n` rounded to the next value that is zero
 * modulo `align`. */
static uintptr_t round_up(uintptr_t n, uintptr_t align) {
	if (n % align) {
		return n + (align - (n % align));
	}
	return n;
}

uintptr_t heap_next, heap_end;

void heap_init(uintptr_t start, uintptr_t end) {
	heap_next = start;
	heap_end = end;
}

void *kalloc_align(uintptr_t size, uintptr_t alignment) {
	wait_acquire(&heap_lock);
	heap_next = round_up(heap_next, alignment);
	uintptr_t ret = heap_next;
	heap_next += size;
	if(heap_next > heap_end) {
		panic("Out of space!");
	}
	release(&heap_lock);
	return (void*)ret;
}

void *kalloc(uintptr_t size) {
	return kalloc_align(size, sizeof(uintptr_t));
}

void kfree(void *ptr, uintptr_t size) {
}


Add move assignment method to Optional<>

--- src/core/lib/gprpp/optional.h
+++ src/core/lib/gprpp/optional.h
@@ -19,6 +19,10 @@
 #ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
 #define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

+#include <grpc/support/port_platform.h>
+
+#include <utility>
+
 namespace grpc_core {

 /* A make-shift alternative for absl::Optional. This can be removed in favor of
@@ -27,8 +31,14 @@
 class Optional {
  public:
   Optional() : value_() {}
+
   void set(const T& val) {
     value_ = val;
+    set_ = true;
+  }
+
+  void set(T&& val) {
+    value_ = std::move(val);
     set_ = true;
   }

<|original_code|>
/*
 *
 * Copyright 2019 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

namespace grpc_core {

/* A make-shift alternative for absl::Optional. This can be removed in favor of
 * that once absl dependencies can be introduced. */
template <typename T>
class Optional {
 public:
  Optional() : value_() {}
  void set(const T& val) {
    value_ = val;
    set_ = true;
  }

  bool has_value() const { return set_; }

  void reset() { set_ = false; }

  T value() const { return value_; }

 private:
  T value_;
  bool set_ = false;
};

} /* namespace grpc_core */

#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */

<|edits_diff|>
--- src/core/lib/gprpp/optional.h
+++ src/core/lib/gprpp/optional.h
@@ -19,6 +19,10 @@
 #ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
 #define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

+#include <grpc/support/port_platform.h>
+
+#include <utility>
+
 namespace grpc_core {

 /* A make-shift alternative for absl::Optional. This can be removed in favor of
@@ -27,6 +31,7 @@
 class Optional {
  public:
   Optional() : value_() {}
+
   void set(const T& val) {
     value_ = val;
     set_ = true;
<|current_version|>
/*
 *
 * Copyright 2019 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

#include <grpc/support/port_platform.h>

#include <utility>

namespace grpc_core {

/* A make-shift alternative for absl::Optional. This can be removed in favor of
 * that once absl dependencies can be introduced. */
template <typename T>
class Optional {
 public:
  Optional() : value_() {}

  void set(const T& val) {
    value_ = val;
    set_ = true;
  }

  bool has_value() const { return set_; }

  void reset() { set_ = false; }

  T value() const { return value_; }

 private:
  T value_;
  bool set_ = false;
};

} /* namespace grpc_core */

#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */

<|next_version|>
/*
 *
 * Copyright 2019 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

#include <grpc/support/port_platform.h>

#include <utility>

namespace grpc_core {

/* A make-shift alternative for absl::Optional. This can be removed in favor of
 * that once absl dependencies can be introduced. */
template <typename T>
class Optional {
 public:
  Optional() : value_() {}

  void set(const T& val) {
    value_ = val;
    set_ = true;
  }

  void set(T&& val) {
    value_ = std::move(val);
    set_ = true;
  }

  bool has_value() const { return set_; }

  void reset() { set_ = false; }

  T value() const { return value_; }

 private:
  T value_;
  bool set_ = false;
};

} /* namespace grpc_core */

#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */


Debug info for init dunction.

Debug info for init dunction.

FossilOrigin-Name: 7127f1670bedbfa09f000dcd4eff557f448184d0450b373e888856979877ccbe

--- src/capwap/dtls_gnutls.c
+++ src/capwap/dtls_gnutls.c
@@ -19,9 +19,11 @@

 #include <gnutls/gnutls.h>

+#include "cw_log.h"

 int dtls_gnutls_init()
 {
+	cw_dbg(DBG_CW_INFO,"Init SSL library - using GnuTLS");
 	gnutls_global_init();
 	return 1;
 }

<|original_code|>
/*
    This file is part of libcapwap.

    libcapwap is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    libcapwap is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

*/

#include <gnutls/gnutls.h>

int dtls_gnutls_init()
{
	gnutls_global_init();
	return 1;
}

<|edits_diff|>
--- src/capwap/dtls_gnutls.c
+++ src/capwap/dtls_gnutls.c
@@ -19,6 +19,7 @@

 #include <gnutls/gnutls.h>

+#include "cw_log.h"

 int dtls_gnutls_init()
 {
<|current_version|>
/*
    This file is part of libcapwap.

    libcapwap is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    libcapwap is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

*/

#include <gnutls/gnutls.h>

#include "cw_log.h"

int dtls_gnutls_init()
{
	gnutls_global_init();
	return 1;
}

<|next_version|>
/*
    This file is part of libcapwap.

    libcapwap is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    libcapwap is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

*/

#include <gnutls/gnutls.h>

#include "cw_log.h"

int dtls_gnutls_init()
{
	cw_dbg(DBG_CW_INFO,"Init SSL library - using GnuTLS");
	gnutls_global_init();
	return 1;
}


Fix bug in shape yaml emit

Fix bug in shape yaml emit

--- src/lib/PMDPage.h
+++ src/lib/PMDPage.h
@@ -33,7 +33,9 @@

   void emitYaml(yaml_emitter_t *emitter) const
   {
+    yamlBeginMap(emitter);
     yamlIndirectForeach(emitter, "shapes", m_shapes);
+    yamlEndMap(emitter);
   }
 };

<|original_code|>
#pragma once
#include "geometry.h"
#include "yaml_utils.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include <librevenge/librevenge.h>

namespace libpagemaker
{

class PMDPage
{
  std::vector<boost::shared_ptr<PMDLineSet> > m_shapes;
public:
  PMDPage() : m_shapes()
  { }

  void addShape(boost::shared_ptr<PMDLineSet> shape)
  {
    m_shapes.push_back(shape);
  }

  unsigned numShapes() const
  {
    return m_shapes.size();
  }

  boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const
  {
    return m_shapes.at(i);
  }

  void emitYaml(yaml_emitter_t *emitter) const
  {
    yamlIndirectForeach(emitter, "shapes", m_shapes);
  }
};

}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */

<|edits_diff|>
--- src/lib/PMDPage.h
+++ src/lib/PMDPage.h
@@ -33,6 +33,7 @@

   void emitYaml(yaml_emitter_t *emitter) const
   {
+    yamlBeginMap(emitter);
     yamlIndirectForeach(emitter, "shapes", m_shapes);
   }
 };
<|current_version|>
#pragma once
#include "geometry.h"
#include "yaml_utils.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include <librevenge/librevenge.h>

namespace libpagemaker
{

class PMDPage
{
  std::vector<boost::shared_ptr<PMDLineSet> > m_shapes;
public:
  PMDPage() : m_shapes()
  { }

  void addShape(boost::shared_ptr<PMDLineSet> shape)
  {
    m_shapes.push_back(shape);
  }

  unsigned numShapes() const
  {
    return m_shapes.size();
  }

  boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const
  {
    return m_shapes.at(i);
  }

  void emitYaml(yaml_emitter_t *emitter) const
  {
    yamlBeginMap(emitter);
    yamlIndirectForeach(emitter, "shapes", m_shapes);
  }
};

}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */

<|next_version|>
#pragma once
#include "geometry.h"
#include "yaml_utils.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include <librevenge/librevenge.h>

namespace libpagemaker
{

class PMDPage
{
  std::vector<boost::shared_ptr<PMDLineSet> > m_shapes;
public:
  PMDPage() : m_shapes()
  { }

  void addShape(boost::shared_ptr<PMDLineSet> shape)
  {
    m_shapes.push_back(shape);
  }

  unsigned numShapes() const
  {
    return m_shapes.size();
  }

  boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const
  {
    return m_shapes.at(i);
  }

  void emitYaml(yaml_emitter_t *emitter) const
  {
    yamlBeginMap(emitter);
    yamlIndirectForeach(emitter, "shapes", m_shapes);
    yamlEndMap(emitter);
  }
};

}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */


Use MAP_ANON if MAP_ANONYMOUS is not defined.

--- iobuf/iobuf_init.c
+++ iobuf/iobuf_init.c
@@ -1,9 +1,14 @@
+#include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/mman.h>
 #include "iobuf.h"

 unsigned iobuf_bufsize = 8192;
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif

 int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags)
 {

<|original_code|>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "iobuf.h"

unsigned iobuf_bufsize = 8192;

int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags)
{
  memset(io, 0, sizeof *io);
  if (!bufsize) bufsize = iobuf_bufsize;
  if (!buffer) {
    if ((buffer = mmap(0, bufsize, PROT_READ|PROT_WRITE,
		       MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) != 0)
      flags |= IOBUF_NEEDSMUNMAP;
    else {
      if ((buffer = malloc(bufsize)) == 0) return 0;
      flags |= IOBUF_NEEDSFREE;
    }
  }
  io->fd = fd;
  io->buffer = buffer;
  io->bufsize = bufsize;
  io->flags = flags;
  return 1;
}

<|edits_diff|>
--- iobuf/iobuf_init.c
+++ iobuf/iobuf_init.c
@@ -1,3 +1,4 @@
+#include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/mman.h>
<|current_version|>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "iobuf.h"

unsigned iobuf_bufsize = 8192;

int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags)
{
  memset(io, 0, sizeof *io);
  if (!bufsize) bufsize = iobuf_bufsize;
  if (!buffer) {
    if ((buffer = mmap(0, bufsize, PROT_READ|PROT_WRITE,
		       MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) != 0)
      flags |= IOBUF_NEEDSMUNMAP;
    else {
      if ((buffer = malloc(bufsize)) == 0) return 0;
      flags |= IOBUF_NEEDSFREE;
    }
  }
  io->fd = fd;
  io->buffer = buffer;
  io->bufsize = bufsize;
  io->flags = flags;
  return 1;
}

<|next_version|>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "iobuf.h"

unsigned iobuf_bufsize = 8192;

#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif

int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags)
{
  memset(io, 0, sizeof *io);
  if (!bufsize) bufsize = iobuf_bufsize;
  if (!buffer) {
    if ((buffer = mmap(0, bufsize, PROT_READ|PROT_WRITE,
		       MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) != 0)
      flags |= IOBUF_NEEDSMUNMAP;
    else {
      if ((buffer = malloc(bufsize)) == 0) return 0;
      flags |= IOBUF_NEEDSFREE;
    }
  }
  io->fd = fd;
  io->buffer = buffer;
  io->bufsize = bufsize;
  io->flags = flags;
  return 1;
}


Fix dirty scheduler tc on windows

Fix dirty scheduler tc on windows

--- erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c
+++ erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c
@@ -1,4 +1,6 @@
+#ifndef __WIN32__
 #include <unistd.h>
+#endif
 #include "erl_nif.h"

 static int
@@ -15,7 +17,11 @@
 dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 {
 #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
+#ifdef __WIN32__
+    Sleep(3000);
+#else
     sleep(3);
+#endif
 #endif
     return enif_make_atom(env, "ok");
 }

<|original_code|>
#include <unistd.h>
#include "erl_nif.h"

static int
load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
{
    ErlNifSysInfo sys_info;
    enif_system_info(&sys_info, sizeof(ErlNifSysInfo));
    if (!sys_info.smp_support || !sys_info.dirty_scheduler_support)
        return 1;
    return 0;
}

static ERL_NIF_TERM
dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
    sleep(3);
#endif
    return enif_make_atom(env, "ok");
}

static ErlNifFunc funcs[] = {
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
    {"dirty_sleeper", 0, dirty_sleeper, ERL_NIF_DIRTY_JOB_IO_BOUND}
#else
    {"dirty_sleeper", 0, dirty_sleeper, 0}
#endif
};

ERL_NIF_INIT(scheduler_SUITE, funcs, &load, NULL, NULL, NULL);

<|edits_diff|>
--- erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c
+++ erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c
@@ -1,4 +1,6 @@
+#ifndef __WIN32__
 #include <unistd.h>
+#endif
 #include "erl_nif.h"

 static int
@@ -15,6 +17,9 @@
 dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 {
 #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
+#ifdef __WIN32__
+    Sleep(3000);
+#else
     sleep(3);
 #endif
     return enif_make_atom(env, "ok");
<|current_version|>
#ifndef __WIN32__
#include <unistd.h>
#endif
#include "erl_nif.h"

static int
load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
{
    ErlNifSysInfo sys_info;
    enif_system_info(&sys_info, sizeof(ErlNifSysInfo));
    if (!sys_info.smp_support || !sys_info.dirty_scheduler_support)
        return 1;
    return 0;
}

static ERL_NIF_TERM
dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
#ifdef __WIN32__
    Sleep(3000);
#else
    sleep(3);
#endif
    return enif_make_atom(env, "ok");
}

static ErlNifFunc funcs[] = {
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
    {"dirty_sleeper", 0, dirty_sleeper, ERL_NIF_DIRTY_JOB_IO_BOUND}
#else
    {"dirty_sleeper", 0, dirty_sleeper, 0}
#endif
};

ERL_NIF_INIT(scheduler_SUITE, funcs, &load, NULL, NULL, NULL);

<|next_version|>
#ifndef __WIN32__
#include <unistd.h>
#endif
#include "erl_nif.h"

static int
load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
{
    ErlNifSysInfo sys_info;
    enif_system_info(&sys_info, sizeof(ErlNifSysInfo));
    if (!sys_info.smp_support || !sys_info.dirty_scheduler_support)
        return 1;
    return 0;
}

static ERL_NIF_TERM
dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
#ifdef __WIN32__
    Sleep(3000);
#else
    sleep(3);
#endif
#endif
    return enif_make_atom(env, "ok");
}

static ErlNifFunc funcs[] = {
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
    {"dirty_sleeper", 0, dirty_sleeper, ERL_NIF_DIRTY_JOB_IO_BOUND}
#else
    {"dirty_sleeper", 0, dirty_sleeper, 0}
#endif
};

ERL_NIF_INIT(scheduler_SUITE, funcs, &load, NULL, NULL, NULL);


Duplicate definition of NAME_MAX macro

Duplicate definition of NAME_MAX macro

I broke the build in rBFIaee0075101b1; this is just a temporary band-aid and
only masks the more general issue described in T58.  If you have an idea for a
better fix, please let me know.

Signed-off-by: Zaheer Chothia <418c8e101762410c9c1204e516611673b0b87d3d@inf.ethz.ch>

--- include/sys/dirent.h
+++ include/sys/dirent.h
@@ -12,7 +12,11 @@

 #include <sys/cdefs.h>

+// Depending on header include order, this may collide with the definition in
+// newlib's <dirent.h>  See open issue: https://code.systems.ethz.ch/T58#1169
+#ifndef NAME_MAX
 #define NAME_MAX 512
+#endif

 struct dirent {
 //    long d_ino;

<|original_code|>
/*
 * Copyright (c) 2007, 2008, 2009, ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
 */

#ifndef DIRENT_H_
#define DIRENT_H_

#include <sys/cdefs.h>

#define NAME_MAX 512

struct dirent {
//    long d_ino;
//    off_t d_off;
//    unsigned short d_reclen;
    char d_name[NAME_MAX + 1];
};

typedef struct {
    struct dirent dirent;
    void *vh; // really a vfs_handle_t
} DIR;

__BEGIN_DECLS
DIR *opendir(const char *pathname);
struct dirent *readdir(DIR* dir);
int closedir(DIR *dir);
__END_DECLS

#endif

<|edits_diff|>
--- include/sys/dirent.h
+++ include/sys/dirent.h
@@ -12,6 +12,9 @@

 #include <sys/cdefs.h>

+// Depending on header include order, this may collide with the definition in
+// newlib's <dirent.h>  See open issue: https://code.systems.ethz.ch/T58#1169
+#ifndef NAME_MAX
 #define NAME_MAX 512

 struct dirent {
<|current_version|>
/*
 * Copyright (c) 2007, 2008, 2009, ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
 */

#ifndef DIRENT_H_
#define DIRENT_H_

#include <sys/cdefs.h>

// Depending on header include order, this may collide with the definition in
// newlib's <dirent.h>  See open issue: https://code.systems.ethz.ch/T58#1169
#ifndef NAME_MAX
#define NAME_MAX 512

struct dirent {
//    long d_ino;
//    off_t d_off;
//    unsigned short d_reclen;
    char d_name[NAME_MAX + 1];
};

typedef struct {
    struct dirent dirent;
    void *vh; // really a vfs_handle_t
} DIR;

__BEGIN_DECLS
DIR *opendir(const char *pathname);
struct dirent *readdir(DIR* dir);
int closedir(DIR *dir);
__END_DECLS

#endif

<|next_version|>
/*
 * Copyright (c) 2007, 2008, 2009, ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
 */

#ifndef DIRENT_H_
#define DIRENT_H_

#include <sys/cdefs.h>

// Depending on header include order, this may collide with the definition in
// newlib's <dirent.h>  See open issue: https://code.systems.ethz.ch/T58#1169
#ifndef NAME_MAX
#define NAME_MAX 512
#endif

struct dirent {
//    long d_ino;
//    off_t d_off;
//    unsigned short d_reclen;
    char d_name[NAME_MAX + 1];
};

typedef struct {
    struct dirent dirent;
    void *vh; // really a vfs_handle_t
} DIR;

__BEGIN_DECLS
DIR *opendir(const char *pathname);
struct dirent *readdir(DIR* dir);
int closedir(DIR *dir);
__END_DECLS

#endif


Allow to set custom DTB/OS_CALL addresses

Setting those from command line during compilation allows
to create a custom setup without the need of modifying the
sources.

--- src/main/c/emulator/src/config.h
+++ src/main/c/emulator/src/config.h
@@ -3,7 +3,13 @@

 //#define QEMU
 #define SIM
+
+#ifndef OS_CALL
 #define OS_CALL 0xC0000000
+#endif
+
+#ifndef DTB
 #define DTB 0xC3000000
+#endif

 #endif

<|original_code|>
#ifndef CONFIG_H
#define CONFIG_H

//#define QEMU
#define SIM
#define OS_CALL 0xC0000000
#define DTB 0xC3000000

#endif

<|edits_diff|>
--- src/main/c/emulator/src/config.h
+++ src/main/c/emulator/src/config.h
@@ -3,7 +3,12 @@

 //#define QEMU
 #define SIM
+
+#ifndef OS_CALL
 #define OS_CALL 0xC0000000
+#endif
+
+#ifndef DTB
 #define DTB 0xC3000000

 #endif
<|current_version|>
#ifndef CONFIG_H
#define CONFIG_H

//#define QEMU
#define SIM

#ifndef OS_CALL
#define OS_CALL 0xC0000000
#endif

#ifndef DTB
#define DTB 0xC3000000

#endif

<|next_version|>
#ifndef CONFIG_H
#define CONFIG_H

//#define QEMU
#define SIM

#ifndef OS_CALL
#define OS_CALL 0xC0000000
#endif

#ifndef DTB
#define DTB 0xC3000000
#endif

#endif


Add clear color to render target

Add clear color to render target

--- ouzel/RenderTarget.h
+++ ouzel/RenderTarget.h
@@ -8,6 +8,7 @@
 #include "Types.h"
 #include "Noncopyable.h"
 #include "Size2.h"
+#include "Color.h"

 namespace ouzel
 {
@@ -24,6 +25,9 @@

             virtual bool init(const Size2& newSize, bool useDepthBuffer);

+            virtual void setClearColor(Color color) { clearColor = color; }
+            virtual Color getClearColor() const { return clearColor; }
+
             TexturePtr getTexture() const { return texture; }

         protected:
@@ -32,6 +36,7 @@
             Size2 size;
             bool depthBuffer = false;

+            Color clearColor;
             TexturePtr texture;
         };
     } // namespace graphics

<|original_code|>
// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include <algorithm>
#include <memory>
#include "Types.h"
#include "Noncopyable.h"
#include "Size2.h"

namespace ouzel
{
    namespace graphics
    {
        class Renderer;
        class Texture;

        class RenderTarget: public Noncopyable
        {
            friend Renderer;
        public:
            virtual ~RenderTarget();

            virtual bool init(const Size2& newSize, bool useDepthBuffer);

            TexturePtr getTexture() const { return texture; }

        protected:
            RenderTarget();

            Size2 size;
            bool depthBuffer = false;

            TexturePtr texture;
        };
    } // namespace graphics
} // namespace ouzel

<|edits_diff|>
--- ouzel/RenderTarget.h
+++ ouzel/RenderTarget.h
@@ -8,6 +8,7 @@
 #include "Types.h"
 #include "Noncopyable.h"
 #include "Size2.h"
+#include "Color.h"

 namespace ouzel
 {
@@ -24,6 +25,9 @@

             virtual bool init(const Size2& newSize, bool useDepthBuffer);

+            virtual void setClearColor(Color color) { clearColor = color; }
+            virtual Color getClearColor() const { return clearColor; }
+
             TexturePtr getTexture() const { return texture; }

         protected:
<|current_version|>
// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include <algorithm>
#include <memory>
#include "Types.h"
#include "Noncopyable.h"
#include "Size2.h"
#include "Color.h"

namespace ouzel
{
    namespace graphics
    {
        class Renderer;
        class Texture;

        class RenderTarget: public Noncopyable
        {
            friend Renderer;
        public:
            virtual ~RenderTarget();

            virtual bool init(const Size2& newSize, bool useDepthBuffer);

            virtual void setClearColor(Color color) { clearColor = color; }
            virtual Color getClearColor() const { return clearColor; }

            TexturePtr getTexture() const { return texture; }

        protected:
            RenderTarget();

            Size2 size;
            bool depthBuffer = false;

            TexturePtr texture;
        };
    } // namespace graphics
} // namespace ouzel

<|next_version|>
// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include <algorithm>
#include <memory>
#include "Types.h"
#include "Noncopyable.h"
#include "Size2.h"
#include "Color.h"

namespace ouzel
{
    namespace graphics
    {
        class Renderer;
        class Texture;

        class RenderTarget: public Noncopyable
        {
            friend Renderer;
        public:
            virtual ~RenderTarget();

            virtual bool init(const Size2& newSize, bool useDepthBuffer);

            virtual void setClearColor(Color color) { clearColor = color; }
            virtual Color getClearColor() const { return clearColor; }

            TexturePtr getTexture() const { return texture; }

        protected:
            RenderTarget();

            Size2 size;
            bool depthBuffer = false;

            Color clearColor;
            TexturePtr texture;
        };
    } // namespace graphics
} // namespace ouzel


Improve windows min max macro for MFC

Improve windows min max macro for MFC

--- Source/LuminoCore/Include/LuminoMath.h
+++ Source/LuminoCore/Include/LuminoMath.h
@@ -1,6 +1,11 @@

 #ifndef LUMINO_MATH_H
 #define LUMINO_MATH_H
+
+#pragma push_macro("min")
+#pragma push_macro("max")
+#undef min
+#undef max

 #include "Lumino/Math/MathUtils.h"
 #include "Lumino/Math/Vector2.h"
@@ -14,4 +19,7 @@
 #include "Lumino/Math/ViewFrustum.h"
 #include "Lumino/Math/Random.h"

+#pragma pop_macro("min")
+#pragma pop_macro("max")
+
 #endif // LUMINO_MATH_H

<|original_code|>

#ifndef LUMINO_MATH_H
#define LUMINO_MATH_H

#include "Lumino/Math/MathUtils.h"
#include "Lumino/Math/Vector2.h"
#include "Lumino/Math/Vector3.h"
#include "Lumino/Math/Vector4.h"
#include "Lumino/Math/Matrix.h"
#include "Lumino/Math/Quaternion.h"
#include "Lumino/Math/AttitudeTransform.h"
#include "Lumino/Math/Geometries.h"
#include "Lumino/Math/Plane.h"
#include "Lumino/Math/ViewFrustum.h"
#include "Lumino/Math/Random.h"

#endif // LUMINO_MATH_H

<|edits_diff|>
--- Source/LuminoCore/Include/LuminoMath.h
+++ Source/LuminoCore/Include/LuminoMath.h
@@ -1,6 +1,11 @@

 #ifndef LUMINO_MATH_H
 #define LUMINO_MATH_H
+
+#pragma push_macro("min")
+#pragma push_macro("max")
+#undef min
+#undef max

 #include "Lumino/Math/MathUtils.h"
 #include "Lumino/Math/Vector2.h"
<|current_version|>

#ifndef LUMINO_MATH_H
#define LUMINO_MATH_H

#pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max

#include "Lumino/Math/MathUtils.h"
#include "Lumino/Math/Vector2.h"
#include "Lumino/Math/Vector3.h"
#include "Lumino/Math/Vector4.h"
#include "Lumino/Math/Matrix.h"
#include "Lumino/Math/Quaternion.h"
#include "Lumino/Math/AttitudeTransform.h"
#include "Lumino/Math/Geometries.h"
#include "Lumino/Math/Plane.h"
#include "Lumino/Math/ViewFrustum.h"
#include "Lumino/Math/Random.h"

#endif // LUMINO_MATH_H

<|next_version|>

#ifndef LUMINO_MATH_H
#define LUMINO_MATH_H

#pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max

#include "Lumino/Math/MathUtils.h"
#include "Lumino/Math/Vector2.h"
#include "Lumino/Math/Vector3.h"
#include "Lumino/Math/Vector4.h"
#include "Lumino/Math/Matrix.h"
#include "Lumino/Math/Quaternion.h"
#include "Lumino/Math/AttitudeTransform.h"
#include "Lumino/Math/Geometries.h"
#include "Lumino/Math/Plane.h"
#include "Lumino/Math/ViewFrustum.h"
#include "Lumino/Math/Random.h"

#pragma pop_macro("min")
#pragma pop_macro("max")

#endif // LUMINO_MATH_H


Fix the endianness of arch_spinlock_t

arm64: Fix the endianness of arch_spinlock_t

The owner and next members of the arch_spinlock_t structure need to be
swapped when compiling for big endian.

Signed-off-by: Catalin Marinas <15ce75b290ebaf27c3f9fd73ab848685ed3d8261@arm.com>
Reported-by: Matthew Leach <968f99dd328b703d57aa48028082f52162903fed@arm.com>
Acked-by: Will Deacon <b913f13ef92ac157955c954ccaaff7be065faba4@arm.com>

--- arch/arm64/include/asm/spinlock_types.h
+++ arch/arm64/include/asm/spinlock_types.h
@@ -23,8 +23,13 @@
 #define TICKET_SHIFT	16

 typedef struct {
+#ifdef __AARCH64EB__
+	u16 next;
+	u16 owner;
+#else
 	u16 owner;
 	u16 next;
+#endif
 } __aligned(4) arch_spinlock_t;

 #define __ARCH_SPIN_LOCK_UNLOCKED	{ 0 , 0 }

<|original_code|>
/*
 * Copyright (C) 2012 ARM Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef __ASM_SPINLOCK_TYPES_H
#define __ASM_SPINLOCK_TYPES_H

#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
# error "please don't include this file directly"
#endif

#define TICKET_SHIFT	16

typedef struct {
	u16 owner;
	u16 next;
} __aligned(4) arch_spinlock_t;

#define __ARCH_SPIN_LOCK_UNLOCKED	{ 0 , 0 }

typedef struct {
	volatile unsigned int lock;
} arch_rwlock_t;

#define __ARCH_RW_LOCK_UNLOCKED		{ 0 }

#endif

<|edits_diff|>
--- arch/arm64/include/asm/spinlock_types.h
+++ arch/arm64/include/asm/spinlock_types.h
@@ -23,6 +23,10 @@
 #define TICKET_SHIFT	16

 typedef struct {
+#ifdef __AARCH64EB__
+	u16 next;
+	u16 owner;
+#else
 	u16 owner;
 	u16 next;
 } __aligned(4) arch_spinlock_t;
<|current_version|>
/*
 * Copyright (C) 2012 ARM Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef __ASM_SPINLOCK_TYPES_H
#define __ASM_SPINLOCK_TYPES_H

#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
# error "please don't include this file directly"
#endif

#define TICKET_SHIFT	16

typedef struct {
#ifdef __AARCH64EB__
	u16 next;
	u16 owner;
#else
	u16 owner;
	u16 next;
} __aligned(4) arch_spinlock_t;

#define __ARCH_SPIN_LOCK_UNLOCKED	{ 0 , 0 }

typedef struct {
	volatile unsigned int lock;
} arch_rwlock_t;

#define __ARCH_RW_LOCK_UNLOCKED		{ 0 }

#endif

<|next_version|>
/*
 * Copyright (C) 2012 ARM Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef __ASM_SPINLOCK_TYPES_H
#define __ASM_SPINLOCK_TYPES_H

#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
# error "please don't include this file directly"
#endif

#define TICKET_SHIFT	16

typedef struct {
#ifdef __AARCH64EB__
	u16 next;
	u16 owner;
#else
	u16 owner;
	u16 next;
#endif
} __aligned(4) arch_spinlock_t;

#define __ARCH_SPIN_LOCK_UNLOCKED	{ 0 , 0 }

typedef struct {
	volatile unsigned int lock;
} arch_rwlock_t;

#define __ARCH_RW_LOCK_UNLOCKED		{ 0 }

#endif


prd: Add generic response structure inside prd_fw_msg

This patch adds generic response structure. Also sync prd_fw_msg type
macros with hostboot.

Next patch makes use of this structure/macro.

CC: Jeremy Kerr <68a658b44bbaefab3ef5cd231967195fc0ff9d69@ozlabs.org>
Signed-off-by: Vasant Hegde <a6d753843573f7bfed5075c1e875b0be8007a0ab@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com>

--- include/prd-fw-msg.h
+++ include/prd-fw-msg.h
@@ -26,10 +26,20 @@
 enum {
 	PRD_FW_MSG_TYPE_REQ_NOP = 0,
 	PRD_FW_MSG_TYPE_RESP_NOP = 1,
+	PRD_FW_MSG_TYPE_RESP_GENERIC = 2,
+	PRD_FW_MSG_TYPE_REQ_HCODE_UPDATE = 3,
+	PRD_FW_MSG_TYPE_HBRT_FSP = 4,
+	PRD_FW_MSG_TYPE_ERROR_LOG = 5,
+	PRD_FW_MSG_TYPE_FSP_HBRT = 6,
 };

 struct prd_fw_msg {
 	__be64		type;
+	union {
+		struct {
+			__be64	status;
+		} generic_resp;
+	};
 };

 #define PRD_FW_MSG_BASE_SIZE	sizeof(__be64)

<|original_code|>
/* Copyright 2017 IBM Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __PRD_FW_MSG_H
#define __PRD_FW_MSG_H

#include <types.h>

/* Messaging structure for the opaque channel between OPAL and HBRT. This
 * format is used for the firmware_request and firmware_notify interfaces
 */
enum {
	PRD_FW_MSG_TYPE_REQ_NOP = 0,
	PRD_FW_MSG_TYPE_RESP_NOP = 1,
};

struct prd_fw_msg {
	__be64		type;
};

#define PRD_FW_MSG_BASE_SIZE	sizeof(__be64)

#endif /* __PRD_FW_MSG_H */

<|edits_diff|>
--- include/prd-fw-msg.h
+++ include/prd-fw-msg.h
@@ -26,6 +26,11 @@
 enum {
 	PRD_FW_MSG_TYPE_REQ_NOP = 0,
 	PRD_FW_MSG_TYPE_RESP_NOP = 1,
+	PRD_FW_MSG_TYPE_RESP_GENERIC = 2,
+	PRD_FW_MSG_TYPE_REQ_HCODE_UPDATE = 3,
+	PRD_FW_MSG_TYPE_HBRT_FSP = 4,
+	PRD_FW_MSG_TYPE_ERROR_LOG = 5,
+	PRD_FW_MSG_TYPE_FSP_HBRT = 6,
 };

 struct prd_fw_msg {
<|current_version|>
/* Copyright 2017 IBM Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __PRD_FW_MSG_H
#define __PRD_FW_MSG_H

#include <types.h>

/* Messaging structure for the opaque channel between OPAL and HBRT. This
 * format is used for the firmware_request and firmware_notify interfaces
 */
enum {
	PRD_FW_MSG_TYPE_REQ_NOP = 0,
	PRD_FW_MSG_TYPE_RESP_NOP = 1,
	PRD_FW_MSG_TYPE_RESP_GENERIC = 2,
	PRD_FW_MSG_TYPE_REQ_HCODE_UPDATE = 3,
	PRD_FW_MSG_TYPE_HBRT_FSP = 4,
	PRD_FW_MSG_TYPE_ERROR_LOG = 5,
	PRD_FW_MSG_TYPE_FSP_HBRT = 6,
};

struct prd_fw_msg {
	__be64		type;
};

#define PRD_FW_MSG_BASE_SIZE	sizeof(__be64)

#endif /* __PRD_FW_MSG_H */

<|next_version|>
/* Copyright 2017 IBM Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __PRD_FW_MSG_H
#define __PRD_FW_MSG_H

#include <types.h>

/* Messaging structure for the opaque channel between OPAL and HBRT. This
 * format is used for the firmware_request and firmware_notify interfaces
 */
enum {
	PRD_FW_MSG_TYPE_REQ_NOP = 0,
	PRD_FW_MSG_TYPE_RESP_NOP = 1,
	PRD_FW_MSG_TYPE_RESP_GENERIC = 2,
	PRD_FW_MSG_TYPE_REQ_HCODE_UPDATE = 3,
	PRD_FW_MSG_TYPE_HBRT_FSP = 4,
	PRD_FW_MSG_TYPE_ERROR_LOG = 5,
	PRD_FW_MSG_TYPE_FSP_HBRT = 6,
};

struct prd_fw_msg {
	__be64		type;
	union {
		struct {
			__be64	status;
		} generic_resp;
	};
};

#define PRD_FW_MSG_BASE_SIZE	sizeof(__be64)

#endif /* __PRD_FW_MSG_H */


Print the number of solutions.

Print the number of solutions.

--- infiniteloop_cmd.c
+++ infiniteloop_cmd.c
@@ -9,6 +9,8 @@

 #include "infiniteloop.h"

+static unsigned int solutions_found = 0;
+
 static bool print_solution(const struct il_solution *s, void *thunk) {
   char buf[1024];
   if (!il_solution_print(s, buf, sizeof(buf))) {
@@ -16,6 +18,7 @@
     exit(1);
   }
   printf("-- SOLUTION --\n%s\n", buf);
+  ++solutions_found;
   return true;
 }

@@ -31,5 +34,7 @@
   }

   il_solve(&p, print_solution, NULL);
+
+  printf("-- FOUND %u SOLUTIONS --\n", solutions_found);
   return 0;
 }

<|original_code|>
// Copyright (c) 2016 Ed Schouten <ed@nuxi.nl>
//
// This file is distributed under a 2-clause BSD license.
// See the LICENSE file for details.

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

#include "infiniteloop.h"

static bool print_solution(const struct il_solution *s, void *thunk) {
  char buf[1024];
  if (!il_solution_print(s, buf, sizeof(buf))) {
    fprintf(stderr, "Failed to print solution\n");
    exit(1);
  }
  printf("-- SOLUTION --\n%s\n", buf);
  return true;
}

int main(void) {
  char buf[1024];
  size_t len = fread(buf, 1, sizeof(buf) - 1, stdin);
  buf[len] = '\0';

  struct il_problem p;
  if (!il_problem_parse(buf, &p)) {
    fprintf(stderr, "Failed to parse input\n");
    return 1;
  }

  il_solve(&p, print_solution, NULL);
  return 0;
}

<|edits_diff|>
--- infiniteloop_cmd.c
+++ infiniteloop_cmd.c
@@ -9,6 +9,8 @@

 #include "infiniteloop.h"

+static unsigned int solutions_found = 0;
+
 static bool print_solution(const struct il_solution *s, void *thunk) {
   char buf[1024];
   if (!il_solution_print(s, buf, sizeof(buf))) {
@@ -16,6 +18,7 @@
     exit(1);
   }
   printf("-- SOLUTION --\n%s\n", buf);
+  ++solutions_found;
   return true;
 }

<|current_version|>
// Copyright (c) 2016 Ed Schouten <ed@nuxi.nl>
//
// This file is distributed under a 2-clause BSD license.
// See the LICENSE file for details.

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

#include "infiniteloop.h"

static unsigned int solutions_found = 0;

static bool print_solution(const struct il_solution *s, void *thunk) {
  char buf[1024];
  if (!il_solution_print(s, buf, sizeof(buf))) {
    fprintf(stderr, "Failed to print solution\n");
    exit(1);
  }
  printf("-- SOLUTION --\n%s\n", buf);
  ++solutions_found;
  return true;
}

int main(void) {
  char buf[1024];
  size_t len = fread(buf, 1, sizeof(buf) - 1, stdin);
  buf[len] = '\0';

  struct il_problem p;
  if (!il_problem_parse(buf, &p)) {
    fprintf(stderr, "Failed to parse input\n");
    return 1;
  }

  il_solve(&p, print_solution, NULL);
  return 0;
}

<|next_version|>
// Copyright (c) 2016 Ed Schouten <ed@nuxi.nl>
//
// This file is distributed under a 2-clause BSD license.
// See the LICENSE file for details.

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

#include "infiniteloop.h"

static unsigned int solutions_found = 0;

static bool print_solution(const struct il_solution *s, void *thunk) {
  char buf[1024];
  if (!il_solution_print(s, buf, sizeof(buf))) {
    fprintf(stderr, "Failed to print solution\n");
    exit(1);
  }
  printf("-- SOLUTION --\n%s\n", buf);
  ++solutions_found;
  return true;
}

int main(void) {
  char buf[1024];
  size_t len = fread(buf, 1, sizeof(buf) - 1, stdin);
  buf[len] = '\0';

  struct il_problem p;
  if (!il_problem_parse(buf, &p)) {
    fprintf(stderr, "Failed to parse input\n");
    return 1;
  }

  il_solve(&p, print_solution, NULL);

  printf("-- FOUND %u SOLUTIONS --\n", solutions_found);
  return 0;
}


Allow bit rotation by more than sizeof(T)*8 bits.

Currently these functions will happily bit shift by >= sizeof(T)*8 bits.
However, this is undefined behavior, and results in unexpected results (0)
on at least one platform I've tested.

With this update, you can expect that rotate_left<uint32_t>(1, 32)==1
and rotate_right<uint32_t>(1, 32)==1.

--- src/lib/utils/rotate.h
+++ src/lib/utils/rotate.h
@@ -20,6 +20,7 @@
 */
 template<typename T> inline T rotate_left(T input, size_t rot)
    {
+   rot %= 8 * sizeof(T);
    return (rot == 0) ? input : static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
    }

@@ -31,6 +32,7 @@
 */
 template<typename T> inline T rotate_right(T input, size_t rot)
    {
+   rot %= 8 * sizeof(T);
    return (rot == 0) ? input : static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot)));
    }

<|original_code|>
/*
* Word Rotation Operations
* (C) 1999-2008 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_WORD_ROTATE_H__
#define BOTAN_WORD_ROTATE_H__

#include <botan/types.h>

namespace Botan {

/**
* Bit rotation left
* @param input the input word
* @param rot the number of bits to rotate
* @return input rotated left by rot bits
*/
template<typename T> inline T rotate_left(T input, size_t rot)
   {
   return (rot == 0) ? input : static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
   }

/**
* Bit rotation right
* @param input the input word
* @param rot the number of bits to rotate
* @return input rotated right by rot bits
*/
template<typename T> inline T rotate_right(T input, size_t rot)
   {
   return (rot == 0) ? input : static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot)));
   }

}

#endif

<|edits_diff|>
--- src/lib/utils/rotate.h
+++ src/lib/utils/rotate.h
@@ -20,6 +20,7 @@
 */
 template<typename T> inline T rotate_left(T input, size_t rot)
    {
+   rot %= 8 * sizeof(T);
    return (rot == 0) ? input : static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
    }

<|current_version|>
/*
* Word Rotation Operations
* (C) 1999-2008 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_WORD_ROTATE_H__
#define BOTAN_WORD_ROTATE_H__

#include <botan/types.h>

namespace Botan {

/**
* Bit rotation left
* @param input the input word
* @param rot the number of bits to rotate
* @return input rotated left by rot bits
*/
template<typename T> inline T rotate_left(T input, size_t rot)
   {
   rot %= 8 * sizeof(T);
   return (rot == 0) ? input : static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
   }

/**
* Bit rotation right
* @param input the input word
* @param rot the number of bits to rotate
* @return input rotated right by rot bits
*/
template<typename T> inline T rotate_right(T input, size_t rot)
   {
   return (rot == 0) ? input : static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot)));
   }

}

#endif

<|next_version|>
/*
* Word Rotation Operations
* (C) 1999-2008 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_WORD_ROTATE_H__
#define BOTAN_WORD_ROTATE_H__

#include <botan/types.h>

namespace Botan {

/**
* Bit rotation left
* @param input the input word
* @param rot the number of bits to rotate
* @return input rotated left by rot bits
*/
template<typename T> inline T rotate_left(T input, size_t rot)
   {
   rot %= 8 * sizeof(T);
   return (rot == 0) ? input : static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
   }

/**
* Bit rotation right
* @param input the input word
* @param rot the number of bits to rotate
* @return input rotated right by rot bits
*/
template<typename T> inline T rotate_right(T input, size_t rot)
   {
   rot %= 8 * sizeof(T);
   return (rot == 0) ? input : static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot)));
   }

}

#endif


Support Pre 0.40 and Post 0.40 React Native.

Handle if else for importing `React/RCTBridgeModule.h`.

--- RNUnifiedContacts/RNUnifiedContacts-Bridging-Header.h
+++ RNUnifiedContacts/RNUnifiedContacts-Bridging-Header.h
@@ -9,7 +9,11 @@
 #ifndef RNUnifiedContacts_Bridging_Header_h
 #define RNUnifiedContacts_Bridging_Header_h

+#if __has_include("RCTBridgeModule.h")
+#import "RCTBridgeModule.h"
+#else
 #import <React/RCTBridgeModule.h>
+#endif

 #endif /* RNUnifiedContacts_Bridging_Header_h */

<|original_code|>
//
//  RNUnifiedContacts.h
//  RNUnifiedContacts
//
//  Created by Joshua Pinter on 2016-03-23.
//  Copyright © 2016 Joshua Pinter. All rights reserved.
//

#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h

#import <React/RCTBridgeModule.h>

#endif /* RNUnifiedContacts_Bridging_Header_h */

<|edits_diff|>
--- RNUnifiedContacts/RNUnifiedContacts-Bridging-Header.h
+++ RNUnifiedContacts/RNUnifiedContacts-Bridging-Header.h
@@ -9,6 +9,9 @@
 #ifndef RNUnifiedContacts_Bridging_Header_h
 #define RNUnifiedContacts_Bridging_Header_h

+#if __has_include("RCTBridgeModule.h")
+#import "RCTBridgeModule.h"
+#else
 #import <React/RCTBridgeModule.h>

 #endif /* RNUnifiedContacts_Bridging_Header_h */
<|current_version|>
//
//  RNUnifiedContacts.h
//  RNUnifiedContacts
//
//  Created by Joshua Pinter on 2016-03-23.
//  Copyright © 2016 Joshua Pinter. All rights reserved.
//

#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h

#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>

#endif /* RNUnifiedContacts_Bridging_Header_h */

<|next_version|>
//
//  RNUnifiedContacts.h
//  RNUnifiedContacts
//
//  Created by Joshua Pinter on 2016-03-23.
//  Copyright © 2016 Joshua Pinter. All rights reserved.
//

#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h

#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>
#endif

#endif /* RNUnifiedContacts_Bridging_Header_h */


Update RingOpenGL 1.1 - Add Constant (Source Code) : GL_FALSE

--- extensions/ringopengl/opengl11/ring_opengl11.c
+++ extensions/ringopengl/opengl11/ring_opengl11.c
@@ -15,7 +15,13 @@
 	RING_API_RETNUMBER(GL_ZERO);
 }

+RING_FUNC(ring_get_gl_false)
+{
+	RING_API_RETNUMBER(GL_FALSE);
+}
+
 RING_API void ringlib_init(RingState *pRingState)
 {
 	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
+	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
 }

<|original_code|>
#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
}

<|edits_diff|>
--- extensions/ringopengl/opengl11/ring_opengl11.c
+++ extensions/ringopengl/opengl11/ring_opengl11.c
@@ -15,6 +15,11 @@
 	RING_API_RETNUMBER(GL_ZERO);
 }

+RING_FUNC(ring_get_gl_false)
+{
+	RING_API_RETNUMBER(GL_FALSE);
+}
+
 RING_API void ringlib_init(RingState *pRingState)
 {
 	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
<|current_version|>
#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
}

<|next_version|>
#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
}


TBD: Add posix-styled functions for using neosmart_event_t objects

--- pevents.h
+++ pevents.h
@@ -5,12 +5,17 @@

 namespace neosmart
 {
+    //Type declarations
 	struct neosmart_event_t_;
 	typedef neosmart_event_t_ * neosmart_event_t;

+    //WIN32-style pevent functions
 	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
 	int DestroyEvent(neosmart_event_t event);
 	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
 	int SetEvent(neosmart_event_t event);
 	int ResetEvent(neosmart_event_t event);
+
+    //posix-style functions
+    //TBD
 }

<|original_code|>
#pragma once

#include <pthread.h>
#include <stdint.h>

namespace neosmart
{
	struct neosmart_event_t_;
	typedef neosmart_event_t_ * neosmart_event_t;

	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
	int DestroyEvent(neosmart_event_t event);
	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
	int SetEvent(neosmart_event_t event);
	int ResetEvent(neosmart_event_t event);
}

<|edits_diff|>
--- pevents.h
+++ pevents.h
@@ -5,9 +5,11 @@

 namespace neosmart
 {
+    //Type declarations
 	struct neosmart_event_t_;
 	typedef neosmart_event_t_ * neosmart_event_t;

+    //WIN32-style pevent functions
 	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
 	int DestroyEvent(neosmart_event_t event);
 	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
<|current_version|>
#pragma once

#include <pthread.h>
#include <stdint.h>

namespace neosmart
{
    //Type declarations
	struct neosmart_event_t_;
	typedef neosmart_event_t_ * neosmart_event_t;

    //WIN32-style pevent functions
	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
	int DestroyEvent(neosmart_event_t event);
	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
	int SetEvent(neosmart_event_t event);
	int ResetEvent(neosmart_event_t event);
}

<|next_version|>
#pragma once

#include <pthread.h>
#include <stdint.h>

namespace neosmart
{
    //Type declarations
	struct neosmart_event_t_;
	typedef neosmart_event_t_ * neosmart_event_t;

    //WIN32-style pevent functions
	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
	int DestroyEvent(neosmart_event_t event);
	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
	int SetEvent(neosmart_event_t event);
	int ResetEvent(neosmart_event_t event);

    //posix-style functions
    //TBD
}


Add assert on rtems_task_variable_add error.

assert is used so that if rtems_task_variable_add fails, the error
is fatal.

R=iant
CC=gofrontend-dev, joel.sherrill
https://golang.org/cl/1684053

--- libgo/runtime/rtems-task-variable-add.c
+++ libgo/runtime/rtems-task-variable-add.c
@@ -3,6 +3,8 @@
    Copyright 2010 The Go Authors. All rights reserved.
    Use of this source code is governed by a BSD-style
    license that can be found in the LICENSE file.  */
+
+#include <assert.h>

 #include <rtems/error.h>
 #include <rtems/system.h>
@@ -16,6 +18,7 @@
   if (sc != RTEMS_SUCCESSFUL)
     {
       rtems_error (sc, "rtems_task_variable_add failed");
+      assert (0);
     }
 }

<|original_code|>
/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS.

   Copyright 2010 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include <rtems/error.h>
#include <rtems/system.h>
#include <rtems/rtems/tasks.h>

/* RTEMS does not support GNU TLS extension __thread.  */
void
__wrap_rtems_task_variable_add (void **var)
{
  rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL);
  if (sc != RTEMS_SUCCESSFUL)
    {
      rtems_error (sc, "rtems_task_variable_add failed");
    }
}

<|edits_diff|>
--- libgo/runtime/rtems-task-variable-add.c
+++ libgo/runtime/rtems-task-variable-add.c
@@ -3,6 +3,8 @@
    Copyright 2010 The Go Authors. All rights reserved.
    Use of this source code is governed by a BSD-style
    license that can be found in the LICENSE file.  */
+
+#include <assert.h>

 #include <rtems/error.h>
 #include <rtems/system.h>
<|current_version|>
/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS.

   Copyright 2010 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include <assert.h>

#include <rtems/error.h>
#include <rtems/system.h>
#include <rtems/rtems/tasks.h>

/* RTEMS does not support GNU TLS extension __thread.  */
void
__wrap_rtems_task_variable_add (void **var)
{
  rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL);
  if (sc != RTEMS_SUCCESSFUL)
    {
      rtems_error (sc, "rtems_task_variable_add failed");
    }
}

<|next_version|>
/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS.

   Copyright 2010 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include <assert.h>

#include <rtems/error.h>
#include <rtems/system.h>
#include <rtems/rtems/tasks.h>

/* RTEMS does not support GNU TLS extension __thread.  */
void
__wrap_rtems_task_variable_add (void **var)
{
  rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL);
  if (sc != RTEMS_SUCCESSFUL)
    {
      rtems_error (sc, "rtems_task_variable_add failed");
      assert (0);
    }
}