/*
 *  Copyright 2006 The WebRTC Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE()                                   \
  rtc::Fatal(__FILE__, __LINE__, "unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

/*
 *  Copyright 2006 The WebRTC Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// Trigger a fatal error (which aborts the process and prints an error
// message). FATAL_ERROR_IF may seem a lot like assert, but there's a crucial
// difference: it's always "on". This means that it can be used to check for
// regular errors that could actually happen, not just programming errors that
// supposedly can't happen---but triggering a fatal error will kill the process
// in an ugly way, so it's not suitable for catching errors that might happen
// in production.
#define FATAL_ERROR(msg) do { rtc::Fatal(__FILE__, __LINE__, msg); } while (0)
#define FATAL_ERROR_IF(x) do { if (x) FATAL_ERROR("check failed"); } while (0)

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE() FATAL_ERROR("unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

Define convenient FATAL_ERROR() and FATAL_ERROR_IF() macros

R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16079004

git-svn-id: 03ae4fbe531b1eefc9d815f31e49022782c42458@6701 4adac7df-926f-26a2-2b94-8c16560cd09d


// PARAM: --set ana.int.interval true --set solver "'new'"
#include<pthread.h>
#include<assert.h>

int glob1 = 5;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&mutex1);
  t = glob1;
  assert(t == 5);
  glob1 = -10;
  assert(glob1 == -10);
  glob1 = t;
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

int main(void) {
  pthread_t id;
  assert(glob1 == 5);
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex1);
  glob1++;
  assert(glob1 == 6);
  glob1--;
  pthread_mutex_unlock(&mutex1);
  pthread_join (id, NULL);
  return 0;
}

// PARAM: --set ana.int.interval true --set solver "'td3'"
#include<pthread.h>
#include<assert.h>

int glob1 = 5;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&mutex1);
  t = glob1;
  assert(t == 5);
  glob1 = -10;
  assert(glob1 == -10);
  glob1 = t;
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

int main(void) {
  pthread_t id;
  assert(glob1 == 5);
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex1);
  glob1++;
  assert(glob1 == 6);
  glob1--;
  pthread_mutex_unlock(&mutex1);
  pthread_join (id, NULL);
  return 0;
}

Switch solver for 13-privatized/17-priv_internal.c to td3 to make test case pass


/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

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 TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

// IWYU pragma: private, include "third_party/tensorflow/core/platform/types.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/types.h

namespace tensorflow {

typedef signed char int8;
typedef short int16;
typedef int int32;
typedef long long int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

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 TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

#include <cstdint>

// IWYU pragma: private, include "third_party/tensorflow/core/platform/types.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/types.h

namespace tensorflow {

typedef signed char int8;
typedef short int16;
typedef int int32;
typedef std::int64_t int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef std::uint64_t uint64;

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

Change definition of tensorflow::int64 to std::int64_t.

There is no reason for TensorFlow to have its own special non-standard `int64` type any more; we can use the standard one instead.

PiperOrigin-RevId: 351674712
Change-Id: I82c1d67c07436a3f158a029a3a657fef5a05060e


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2012, 2013, 2014  Raymond Jennings
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kotaka/paths/algorithm.h>
#include <kotaka/paths/bigstruct.h>
#include <kotaka/paths/system.h>
#include <kotaka/paths/string.h>
#include <kotaka/paths/verb.h>
#include <kernel/access.h>
#include <status.h>

inherit LIB_VERB;

string *query_parse_methods()
{
	return ({ "raw" });
}

int compare(string a, string b)
{
	int na, nb;

	sscanf(a, "%s#%d", a, na);
	sscanf(b, "%s#%d", b, nb);

	if (na > nb) {
		return 1;
	}
	if (na < nb) {
		return -1;
	}
	return 0;
}

void printlist(string path)
{
	mixed st;
	object cinfo;
	object obj;

	st = status(path);

	if (!st) {
		send_out("No such object.\n");
		return;
	}

	cinfo = CLONED->query_clone_info(st[O_INDEX]);

	if (!cinfo) {
		send_out("No clone info for object.\n");
		return;
	}

	obj = cinfo->query_first_clone();

	do {
		send_out(STRINGD->mixed_sprint(obj) + ", with access grants " + STRINGD->mixed_sprint(obj->query_grants()) + "\n");

		obj = obj->query_next_clone();
	} while (obj != cinfo->query_first_clone());
}

void main(object actor, mapping roles)
{
	if (query_user()->query_class() < 2) {
		send_out("You do not have sufficient access rights to do a clone check.\n");
		return;
	}

	printlist("~Bigstruct/obj/array/root");
	printlist("~Bigstruct/obj/deque/root");
	printlist("~Bigstruct/obj/map/root");
}

Add a command to check bigstruct owners, used to check for leaks


// SKIP PARAM: --set ana.activated[+] apron --set ana.activated[-] threadflag
// Minimized from sv-benchmarks/c/systemc/pipeline.cil-1.c
#include <assert.h>

int main_clk_pos_edge;
int main_in1_req_up;

int main()
{
  // main_clk_pos_edge = 2; // TODO: uncomment to unskip apron test
  if (main_in1_req_up == 1) // TODO: both branches are dead
    assert(0); // TODO: uncomment to unskip apron test, FAIL (unreachable)
  else
    assert(1); // reachable
  return (0);
}

Add minimized testcase from both apron branches dead without threadflag


//
//  TRVSDictionaryWithCaseInsensitivity.h
//  TRVSDictionaryWithCaseInsensitivity
//
//  Created by Travis Jeffery on 7/24/14.
//  Copyright (c) 2014 Travis Jeffery. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT double TRVSDictionaryWithCaseInsensitivityVersionNumber;

//! Project version string for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT const unsigned char TRVSDictionaryWithCaseInsensitivityVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <TRVSDictionaryWithCaseInsensitivity/PublicHeader.h>

@interface TRVSDictionaryWithCaseInsensitivity : NSDictionary

@end

//
//  TRVSDictionaryWithCaseInsensitivity.h
//  TRVSDictionaryWithCaseInsensitivity
//
//  Created by Travis Jeffery on 7/24/14.
//  Copyright (c) 2014 Travis Jeffery. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT double TRVSDictionaryWithCaseInsensitivityVersionNumber;

//! Project version string for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT const unsigned char TRVSDictionaryWithCaseInsensitivityVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <TRVSDictionaryWithCaseInsensitivity/PublicHeader.h>

@interface TRVSDictionaryWithCaseInsensitivity : NSDictionary

@end

Fix import of foundation - no need for uikit


//
//  SDLImageField+ScreenManagerExtensions.h
//  SmartDeviceLink
//
//  Created by Joel Fischer on 5/20/20.
//  Copyright © 2020 smartdevicelink. All rights reserved.
//

#import <SmartDeviceLink/SmartDeviceLink.h>

NS_ASSUME_NONNULL_BEGIN

@interface SDLImageField (ScreenManagerExtensions)

+ (NSArray<SDLImageField *> *)allImageFields;

@end

NS_ASSUME_NONNULL_END

//
//  SDLImageField+ScreenManagerExtensions.h
//  SmartDeviceLink
//
//  Created by Joel Fischer on 5/20/20.
//  Copyright © 2020 smartdevicelink. All rights reserved.
//

#import "SDLImageField.h"

NS_ASSUME_NONNULL_BEGIN

@interface SDLImageField (ScreenManagerExtensions)

+ (NSArray<SDLImageField *> *)allImageFields;

@end

NS_ASSUME_NONNULL_END

Fix failed import in podspec

Fix failed import in podspec


#include <ruby.h>
#include <errno.h>
#include <sys/capability.h>

static VALUE cap2_getpcaps(VALUE self, VALUE pid) {
  cap_t cap_d;
  ssize_t length;
  char *caps;
  VALUE result;

  Check_Type(pid, T_FIXNUM);

  cap_d = cap_get_pid(NUM2INT(pid));

  if (cap_d == NULL) {
    rb_raise(
      rb_eRuntimeError,
      "Failed to get cap's for proccess %d: (%s)\n",
      NUM2INT(pid), strerror(errno)
    );
  } else {
    caps = cap_to_text(cap_d, &length);
    result = rb_str_new(caps, length);
    cap_free(caps);
    cap_free(cap_d);
  }

  return result;
}

void Init_cap2(void) {
  VALUE rb_mCap2;

  rb_mCap2 = rb_define_module("Cap2");

  rb_define_module_function(rb_mCap2, "getpcaps", cap2_getpcaps, 1);
}

#include <ruby.h>
#include <errno.h>
#include <sys/capability.h>

static VALUE cap2_getpcaps(VALUE self, VALUE pid) {
  cap_t cap_d;
  ssize_t length;
  char *caps;
  VALUE result;

  Check_Type(pid, T_FIXNUM);

  cap_d = cap_get_pid(FIX2INT(pid));

  if (cap_d == NULL) {
    rb_raise(
      rb_eRuntimeError,
      "Failed to get cap's for proccess %d: (%s)\n",
      FIX2INT(pid), strerror(errno)
    );
  } else {
    caps = cap_to_text(cap_d, &length);
    result = rb_str_new(caps, length);
    cap_free(caps);
    cap_free(cap_d);
  }

  return result;
}

void Init_cap2(void) {
  VALUE rb_mCap2;

  rb_mCap2 = rb_define_module("Cap2");

  rb_define_module_function(rb_mCap2, "getpcaps", cap2_getpcaps, 1);
}

Use FIX2INT rather than NUM2INT in Cap2.getpcaps


#pragma once

#include <cstddef>

namespace scratch {

template<size_t Index, typename T, typename... Rest> struct nth : nth<Index-1, Rest...> {};
template<typename T, typename... Rest> struct nth<0, T, Rest...> { using type = T; };

template<size_t Index, typename... Ts> using nth_t = typename nth<Index, Ts...>::type;

} // namespace scratch

Add a template type alias `scratch::nth_t<I, Ts...>` for the nth element of a pack.

The equivalent for (perfectly forwarded) values is basically

    std::get<I>(std::forward_as_tuple(std::forward<Vs>(vs)...))

but since I haven't implemented `std::tuple` yet, I'm passing on that one.


#ifndef CCSPEC_CORE_EXAMPLE_GROUP_H_
#define CCSPEC_CORE_EXAMPLE_GROUP_H_

#include <functional>
#include <list>
#include <stack>
#include <string>

namespace ccspec {
namespace core {

class ExampleGroup;

typedef ExampleGroup* Creator(std::string desc, std::function<void ()> spec);

class ExampleGroup {
  public:
    virtual ~ExampleGroup();

    void addChild(ExampleGroup*);

  protected:
    ExampleGroup(std::string desc);

  private:
    std::string desc_;
    std::list<ExampleGroup*> children_;

    friend Creator describe;
    friend Creator context;
};

extern std::stack<ExampleGroup*> groups_being_defined;

Creator describe;
Creator context;

} // namespace core
} // namespace ccspec

#endif // CCSPEC_CORE_EXAMPLE_GROUP_H_

#ifndef CCSPEC_CORE_EXAMPLE_GROUP_H_
#define CCSPEC_CORE_EXAMPLE_GROUP_H_

#include <functional>
#include <list>
#include <stack>
#include <string>

namespace ccspec {
namespace core {

class ExampleGroup;

typedef ExampleGroup* Creator(std::string desc, std::function<void ()> spec);

extern std::stack<ExampleGroup*> groups_being_defined;

class ExampleGroup {
  public:
    virtual ~ExampleGroup();

    void addChild(ExampleGroup*);

  protected:
    ExampleGroup(std::string desc);

  private:
    std::string desc_;
    std::list<ExampleGroup*> children_;

    friend Creator describe;
    friend Creator context;
};

Creator describe;
Creator context;

} // namespace core
} // namespace ccspec

#endif // CCSPEC_CORE_EXAMPLE_GROUP_H_

Move global variable declaration for consistency


/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef FILTER_H
#define FILTER_H

#include "variable.h"

#include "grantlee_export.h"

namespace Grantlee
{
class Parser;
}

class Token;

namespace Grantlee
{

class GRANTLEE_EXPORT FilterExpression
{
public:
  enum Reversed
  {
    IsNotReversed,
    IsReversed
  };

  FilterExpression();
  FilterExpression(const QString &varString, Grantlee::Parser *parser = 0);

  int error();

//   QList<QPair<QString, QString> > filters();
  Variable variable();

  QVariant resolve(Context *c);

  bool isTrue(Context *c);

  QVariantList toList(Context *c);

private:
  Variable m_variable;
  int m_error;

};

}

#endif

/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef FILTEREXPRESSION_H
#define FILTEREXPRESSION_H

#include "variable.h"

#include "grantlee_export.h"

namespace Grantlee
{
class Parser;
}

class Token;

namespace Grantlee
{

class GRANTLEE_EXPORT FilterExpression
{
public:
  enum Reversed
  {
    IsNotReversed,
    IsReversed
  };

  FilterExpression();
  FilterExpression(const QString &varString, Grantlee::Parser *parser = 0);

  int error();

//   QList<QPair<QString, QString> > filters();
  Variable variable();

  QVariant resolve(Context *c);

  bool isTrue(Context *c);

  QVariantList toList(Context *c);

private:
  Variable m_variable;
  int m_error;

};

}

#endif

Use a correct include guard

Use a correct include guard


/**
   \file
   Particle property interface

   \author Lukas Nellen
   \version $Id$
   \date 03 Apr 2004
*/

#pragma once
#include <string>

namespace corsika
{

  /**
     \class VParticleProperties VParticleProperties.h "corsika/VParticleProperties.h"

     \brief Internal interface for particle properties. This is
     intended to be implemented for elementary particles and nuclei.

     \note This is an internal interface and not available for user code.

     \author Lukas Nellen
     \date 03 Apr 2004
     \ingroup particles
  */

  class VParticleProperties {

  public:
    virtual ~VParticleProperties() { }

    /// Get particle type (using PDG particle codes)
    virtual int GetType() const = 0;

    /// Get particle name
    virtual std::string GetName() const = 0;

    /// Get particle mass (in Auger units)
    virtual double GetMass() const = 0;

  };

  typedef std::shared_ptr<const VParticleProperties> ParticlePropertiesPtr;

}

/**
   \file
   Particle property interface

   \author Lukas Nellen
   \version $Id$
   \date 03 Apr 2004
*/

#pragma once
#include <string>
#include <memory.h>

namespace corsika
{

  /**
     \class VParticleProperties VParticleProperties.h "corsika/VParticleProperties.h"

     \brief Internal interface for particle properties. This is
     intended to be implemented for elementary particles and nuclei.

     \note This is an internal interface and not available for user code.

     \author Lukas Nellen
     \date 03 Apr 2004
     \ingroup particles
  */

  class VParticleProperties {

  public:
    virtual ~VParticleProperties() { }

    /// Get particle type (using PDG particle codes)
    virtual int GetType() const = 0;

    /// Get particle name
    virtual std::string GetName() const = 0;

    /// Get particle mass (in Auger units)
    virtual double GetMass() const = 0;

  };

  typedef std::shared_ptr<const VParticleProperties> ParticlePropertiesPtr;

}

Add one more memory include

Add one more memory include


#pragma once

#include <memory>
#include <vector>
#include "halley/core/game/main_loop.h"

#ifdef _WIN32
#define HALLEY_STDCALL __stdcall
#else
#define HALLEY_STDCALL
#endif

namespace Halley
{
	class Game;
	class Core;
	class HalleyStatics;

	constexpr static uint32_t HALLEY_DLL_API_VERSION = 23;

	class IHalleyEntryPoint
	{
	public:
		virtual ~IHalleyEntryPoint() = default;

		void initSharedStatics(const HalleyStatics& parent);
		virtual uint32_t getApiVersion() { return HALLEY_DLL_API_VERSION; }

		virtual std::unique_ptr<Core> createCore(const std::vector<std::string>& args) = 0;
		virtual std::unique_ptr<Game> createGame() = 0;
	};

	template <typename GameType>
	class HalleyEntryPoint final : public IHalleyEntryPoint
	{
	public:
		std::unique_ptr<Game> createGame() override
		{
			return std::make_unique<GameType>();
		}

		std::unique_ptr<Core> createCore(const std::vector<std::string>& args) override
		{
			Expects(args.size() >= 1);
			Expects(args.size() < 1000);
			return std::make_unique<Core>(std::make_unique<GameType>(), args);
		}
	};
}

#pragma once

#include <memory>
#include <vector>
#include "halley/core/game/main_loop.h"

#ifdef _WIN32
#define HALLEY_STDCALL __stdcall
#else
#define HALLEY_STDCALL
#endif

namespace Halley
{
	class Game;
	class Core;
	class HalleyStatics;

	constexpr static uint32_t HALLEY_DLL_API_VERSION = 24;

	class IHalleyEntryPoint
	{
	public:
		virtual ~IHalleyEntryPoint() = default;

		virtual uint32_t getApiVersion() { return HALLEY_DLL_API_VERSION; }
		virtual std::unique_ptr<Core> createCore(const std::vector<std::string>& args) = 0;
		virtual std::unique_ptr<Game> createGame() = 0;
		void initSharedStatics(const HalleyStatics& parent);
	};

	template <typename GameType>
	class HalleyEntryPoint final : public IHalleyEntryPoint
	{
	public:
		std::unique_ptr<Game> createGame() override
		{
			return std::make_unique<GameType>();
		}

		std::unique_ptr<Core> createCore(const std::vector<std::string>& args) override
		{
			Expects(args.size() >= 1);
			Expects(args.size() < 1000);
			return std::make_unique<Core>(std::make_unique<GameType>(), args);
		}
	};
}

Move new method on interface further down to avoid messing with vtable compatibility


#ifndef SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#define SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#include <Eigen/Core>
#include <memory>
#include <vector>
#include "./labels_arranger.h"

class CudaArrayProvider;

namespace Placement
{

/**
 * \brief Returns the labels in an order defined by the apollonius graph
 *
 */
class ApolloniusLabelsArranger : public LabelsArranger
{
 public:
  ApolloniusLabelsArranger() = default;
  virtual ~ApolloniusLabelsArranger();

  void
  initialize(std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper,
             std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper);

  virtual std::vector<Label>
  getArrangement(const LabellerFrameData &frameData,
                 std::shared_ptr<LabelsContainer> labels);

 private:
  std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper;
  std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper;

  std::vector<Eigen::Vector4f>
  createLabelSeeds(Eigen::Vector2i size, Eigen::Matrix4f viewProjection,
                   std::shared_ptr<LabelsContainer> labels);
};

}  // namespace Placement

#endif  // SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#ifndef SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#define SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#include <Eigen/Core>
#include <memory>
#include <vector>
#include "./labels_arranger.h"

class CudaArrayProvider;

namespace Placement
{

/**
 * \brief Returns the labels in an order defined by the apollonius graph
 *
 */
class ApolloniusLabelsArranger : public LabelsArranger
{
 public:
  ApolloniusLabelsArranger() = default;

  void
  initialize(std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper,
             std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper);

  virtual std::vector<Label>
  getArrangement(const LabellerFrameData &frameData,
                 std::shared_ptr<LabelsContainer> labels);

 private:
  std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper;
  std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper;

  std::vector<Eigen::Vector4f>
  createLabelSeeds(Eigen::Vector2i size, Eigen::Matrix4f viewProjection,
                   std::shared_ptr<LabelsContainer> labels);
};

}  // namespace Placement

#endif  // SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

Remove unused and not implement ApolloniusLabelsArranger destructor.


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

#pragma once

#include "Stdafx.h"

using namespace CefSharp;

namespace CefSharp
{
    namespace Internals
    {
        public ref class CefRequestCallbackWrapper : public IRequestCallback
        {
        private:
            MCefRefPtr<CefRequestCallback> _callback;
            IFrame^ _frame;
            IRequest^ _request;

        internal:
            CefRequestCallbackWrapper(CefRefPtr<CefRequestCallback> &callback)
                : _callback(callback)
            {
            }

            CefRequestCallbackWrapper(
                CefRefPtr<CefRequestCallback> &callback,
                IFrame^ frame,
                IRequest^ request)
                : _callback(callback), _frame(frame), _request(request)
            {
            }

            !CefRequestCallbackWrapper()
            {
                _callback = NULL;
            }

            ~CefRequestCallbackWrapper()
            {
                this->!CefRequestCallbackWrapper();
                delete _requestWrapper;
                _requestWrapper = nullptr;
                delete _frame;
                _frame = nullptr;
            }

        public:
            virtual void Continue(bool allow)
            {
                _callback->Continue(allow);
                delete this;
            }

            virtual void Cancel()
            {
                _callback->Cancel();
                delete this;
            }
        };
    }
}

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

#pragma once

#include "Stdafx.h"

using namespace CefSharp;

namespace CefSharp
{
    namespace Internals
    {
        public ref class CefRequestCallbackWrapper : public IRequestCallback
        {
        private:
            MCefRefPtr<CefRequestCallback> _callback;
            IFrame^ _frame;
            IRequest^ _request;

        internal:
            CefRequestCallbackWrapper(CefRefPtr<CefRequestCallback> &callback)
                : _callback(callback)
            {
            }

            CefRequestCallbackWrapper(
                CefRefPtr<CefRequestCallback> &callback,
                IFrame^ frame,
                IRequest^ request)
                : _callback(callback), _frame(frame), _request(request)
            {
            }

            !CefRequestCallbackWrapper()
            {
                _callback = NULL;
            }

            ~CefRequestCallbackWrapper()
            {
                this->!CefRequestCallbackWrapper();
                delete _request;
                _request = nullptr;
                delete _frame;
                _frame = nullptr;
            }

        public:
            virtual void Continue(bool allow)
            {
                _callback->Continue(allow);
                delete this;
            }

            virtual void Cancel()
            {
                _callback->Cancel();
                delete this;
            }
        };
    }
}

Fix build issue from prev. merge.

Fix build issue from prev. merge.


/*
 * factory.c for Linsys SDI consumer
*/

#include <framework/mlt.h>
#include <string.h>

extern mlt_consumer consumer_SDIstream_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );

MLT_REPOSITORY
{
	MLT_REGISTER( consumer_type, "linsys_sdi", consumer_SDIstream_init );
}

/*
 * factory.c for Linsys SDI consumer
*/

#include <framework/mlt.h>
#include <string.h>

extern mlt_consumer consumer_SDIstream_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );

MLT_REPOSITORY
{
	MLT_REGISTER( consumer_type, "sdi", consumer_SDIstream_init );
}

Change linssys_sdi consumer to just "sdi"


#import "Expecta.h"

EXPMatcherInterface(beIdenticalTo, (void *expected));

#import "Expecta.h"

EXPMatcherInterface(_beIdenticalTo, (void *expected));

#if __has_feature(objc_arc)
#define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected)
#else
#define beIdenticalTo _beIdenticalTo
#endif

Fix ARC warning and avoid having to bridge id objects


/*-------------------------------------------------------------------------
 *
 * copydir.h
 *	  Header for src/port/copydir.c compatibility functions.
 *
 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/storage/copydir.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef COPYDIR_H
#define COPYDIR_H

extern void copydir(char *fromdir, char *todir, bool recurse);

#endif   /* COPYDIR_H */

/*-------------------------------------------------------------------------
 *
 * copydir.h
 *	  Copy a directory.
 *
 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/storage/copydir.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef COPYDIR_H
#define COPYDIR_H

extern void copydir(char *fromdir, char *todir, bool recurse);

#endif   /* COPYDIR_H */

Fix copy-and-pasteo a little more completely.

copydir.c is no longer in src/port


#include <stdio.h>
#include <stdlib.h>
#include <vl/ib.h>

int main()
{
    vl_node nrows = 30;
    vl_node ncols = 3;
    vl_prob * Pic = malloc(sizeof(vl_prob)*nrows*ncols);
    int r,c;
    printf("Pic = [");
    for(r=0; r<nrows; r++)
    {
        for(c=0; c<ncols; c++)
        {
            Pic[r*ncols+c] = rand() % 100;
            printf("%f ", Pic[r*ncols+c]);
        }
        printf("; ...\n");
    }
    printf("];\n");

    printf("IB starting\n");
    // parents always has size 2*nrows-1
    vl_node * parents = vl_ib(Pic, nrows, ncols);
    for(r=0; r<2*nrows-1; r++)
        printf("%d => %d\n", r, parents[r]);

    free(parents);
    free(Pic);

    printf("IB done\n");
    return 0;
}

Add a simple IB test program

Add a simple IB test program


// RUN: not %llvmgcc -mssse3 -S -o /dev/null %s |& grep "error: mask must be an immediate"
// XFAIL: *
// XTARGET: x86,i386,i686

#include <tmmintrin.h>

extern int i;

int main ()
{
#if defined( __SSSE3__ )

  typedef int16_t     vSInt16         __attribute__ ((__vector_size__ (16)));

  short   dtbl[] = {1,2,3,4,5,6,7,8};
  vSInt16 *vdtbl = (vSInt16*) dtbl;

  vSInt16 v0;
  v0 = *vdtbl;
  v0 = _mm_alignr_epi8(v0, v0, i);

  return 0;
#endif
}

Add a test for the llvm-gcc commit in r90200.

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


/* Each new term in the Fibonacci sequence is generated by adding the previous
 * two terms. By starting with 1 and 2, the first 10 terms will be:
 *
 * 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
 *
 * By considering the terms in the Fibonacci sequence whose values do not
 * exceed four million, find the sum of the even-valued terms.
 */

#include <stdio.h>

#define LIMIT 4000000

int
main(int argc, char **argv)
{
    int prev = 0, next = 1, sum = 0, cur = 0;

    do {
        cur = prev + next;
        if(cur % 2 == 0) {
            sum += cur;
        }
        prev = next;
        next = cur;
    } while (cur < LIMIT);
    printf("%i", sum);
    return 0;
}

Add solution for problem 2

Add solution for problem 2


/*
 *  Copyright (c) 2014-present, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

#import <Foundation/Foundation.h>

#import <ComponentKit/CKComponentViewConfiguration.h>

@class CKComponent;
@class UIView;

/**
 CKComponentHierarchyDebugHelper allows
 */
@interface CKComponentHierarchyDebugHelper : NSObject
/**
 Describe the component hierarchy starting from the window. This recursively searches downwards in the view hierarchy to
 find views which have a lifecycle manager, from which we can get the component layout hierarchies.
 @return A string with a description of the hierarchy.
 */
+ (NSString *)componentHierarchyDescription;

@end

/*
 *  Copyright (c) 2014-present, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

#import <Foundation/Foundation.h>

#import <ComponentKit/CKComponentViewConfiguration.h>

@class CKComponent;
@class UIView;

/**
 CKComponentHierarchyDebugHelper allows
 */
@interface CKComponentHierarchyDebugHelper : NSObject
/**
 Describe the component hierarchy starting from the window. This recursively searches downwards in the view hierarchy to
 find views which have a lifecycle manager, from which we can get the component layout hierarchies.
 @return A string with a description of the hierarchy.
 */
+ (NSString *)componentHierarchyDescription NS_EXTENSION_UNAVAILABLE("Recursively describes components using -[UIApplication keyWindow]");

@end

Mark remaining APIs unsafe in extensions

This is a follow up to #534 that should help us close out #390.


#define KNRM  "\x1B[0m"
#define KRED  "\x1B[31m"
#define KGRN  "\x1B[32m"
#define KYEL  "\x1B[33m"
#define KBLU  "\x1B[34m"
#define KMAG  "\x1B[35m"
#define KCYN  "\x1B[36m"
#define KWHT  "\x1B[37m"

#define PRINT_RED(...) \
	printf("%s", KRED);  \
  printf(__VA_ARGS__); \
	printf("%s", KNRM);  \

#define PRINT_GREEN(...) \
	printf("%s", KGRN);  \
  printf(__VA_ARGS__); \
	printf("%s", KNRM);  \

Add pretty (color) printing macros. Unused currently.


/*
 * Medical Image Registration ToolKit (MIRTK)
 *
 * Copyright 2013-2015 Imperial College London
 * Copyright 2013-2015 Andreas Schuh
 *
 * 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 MIRTK_Status_H
#define MIRTK_Status_H

namespace mirtk {

// -----------------------------------------------------------------------------
/// Enumeration of common states for entities such as objective function parameters
enum Status
{
  Active,
  Passive,
};

} // namespace mirtk

#endif // MIRTK_Status_H

/*
 * Medical Image Registration ToolKit (MIRTK)
 *
 * Copyright 2013-2015 Imperial College London
 * Copyright 2013-2015 Andreas Schuh
 *
 * 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 MIRTK_Status_H
#define MIRTK_Status_H

namespace mirtk {

// -----------------------------------------------------------------------------
/// Enumeration of common states for entities such as objective function parameters
enum Status
{
  Active,
  Passive
};

} // namespace mirtk

#endif // MIRTK_Status_H

style: Remove needless comma after last enumeration value [Common]


/*
 * libopensync - A synchronization framework
 * Copyright (C) 2008  Daniel Gollub <dgollub@suse.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 */

#ifndef _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_
#define _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_

/*! @brief OSyncPluginConnectionType String Map
 *
 * @ingroup OSyncPluginConnectionInternalsAPI
 **/

typedef struct {
	OSyncPluginConnectionType type;
	const char *string;
} OSyncPluginConnectionTypeString;

const char *osync_plugin_connection_get_type_string(OSyncPluginConnectionType conn_type);

#endif /*_OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_*/

Add missing file from previous commit.

Add missing file from previous commit.

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@4287 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e


#ifndef __ENTITY_H__
#define __ENTITY_H__

#include "ModuleCollision.h"

class Entity
{
public:

	Entity() : parent(nullptr) {}

	Entity(Entity* parent) : parent(parent) {}

	virtual ~Entity() {}

	// Entity lifecycle methods

	virtual bool Start()
	{
		return true;
	}

	virtual bool Start(bool active)
	{
		this->active = active;
		return true;
	}

	bool Enable()
	{
		if (!active)
			return active = Start();
		return true;
	}

	bool Disable()
	{
		if (active)
			return active = !CleanUp();
		return false;
	}

	virtual void PreUpdate() {}

	virtual void Update() {}

	virtual void PostUpdate() {}

	virtual bool CleanUp()
	{
		return true;
	}

	// Callbacks
	virtual bool OnCollision(Collider origin, Collider other)
	{
		return true;
	}

private:
	bool active = true;
	Entity* parent;
};

#endif // __ENTITY_H__

#ifndef __ENTITY_H__
#define __ENTITY_H__

#include "ModuleCollision.h"

class Entity
{
public:

	Entity() : Parent(nullptr) {}

	Entity(Entity* parent) : Parent(parent) {}

	virtual ~Entity() {}

	// Entity lifecycle methods

	virtual bool Start()
	{
		return true;
	}

	virtual bool Start(bool active)
	{
		this->_active = active;
		return true;
	}

	bool Enable()
	{
		if (!_active)
			return _active = Start();
		return true;
	}

	bool Disable()
	{
		if (_active)
			return _active = !CleanUp();
		return false;
	}

	virtual void PreUpdate() {}

	virtual void Update() {}

	virtual void PostUpdate() {}

	virtual bool CleanUp()
	{
		return true;
	}

	// Callbacks
	virtual bool OnCollision(Collider origin, Collider other)
	{
		return true;
	}

public:
	Entity* Parent;

private:
	bool _active = true;
};

#endif // __ENTITY_H__

Adjust entity class to naming conventions

references #3


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

int check_date(struct tm *date, time_t time, char *name) {
    if( date == NULL ) {
        printf("%s(%lld) returned null\n", name, (long long)time);
        return 1;
    }
    else {
        printf("%s(%lld): %s\n", name, (long long)time, asctime(date));
        return 0;
    }
}

int main(int argc, char *argv[]) {
    long long number;
    time_t time;
    struct tm *localdate;
    struct tm *gmdate;

    if( argc <= 1 ) {
        printf("usage: %s <time>\n", argv[0]);
        return 1;
    }

    number = strtoll(argv[1], NULL, 0);
    time = (time_t)number;

    printf("input: %lld, time: %lld\n", number, (long long)time);
    if( time != number ) {
        printf("time_t overflowed\n");
        return 0;
    }

    localdate = localtime(&time);
    gmdate    = gmtime(&time);

    check_date(localdate, time, "localtime");
    check_date(gmdate,    time, "gmtime");

    return 0;
}

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

int check_date(struct tm *date, time_t time, char *name) {
    if( date == NULL ) {
        printf("%s(%lld) returned null\n", name, (long long)time);
        return 1;
    }
    else {
        printf("%s(%lld): %s\n", name, (long long)time, asctime(date));
        return 0;
    }
}

int main(int argc, char *argv[]) {
    long long number;
    time_t time;
    struct tm *localdate;
    struct tm *gmdate;

    if( argc <= 1 ) {
        printf("usage: %s <time>\n", argv[0]);
        return 1;
    }

    printf("sizeof time_t: %ld, tm.tm_year: %ld\n", sizeof(time_t), sizeof(gmdate->tm_year));

    number = strtoll(argv[1], NULL, 0);
    time = (time_t)number;

    printf("input: %lld, time: %lld\n", number, (long long)time);
    if( time != number ) {
        printf("time_t overflowed\n");
        return 0;
    }

    localdate = localtime(&time);
    gmdate    = gmtime(&time);

    check_date(localdate, time, "localtime");
    check_date(gmdate,    time, "gmtime");

    return 0;
}

Print out the size of time_t and tm.tm_year for debugging porpuses.


#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol WMFAnalyticsLogging <NSObject>

- (NSString*)analyticsName;

@end

NS_ASSUME_NONNULL_END

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol WMFAnalyticsContextProviding <NSObject>

- (NSString*)analyticsContext;

@end

@protocol WMFAnalyticsContentTypeProviding <NSObject>

- (NSString*)analyticsContentType;

@end

@protocol WMFAnalyticsViewNameProviding <NSObject>

- (NSString*)analyticsName;

@end

NS_ASSUME_NONNULL_END

Add additional protocols for tracking context, content type, and analytics name


//PARAM: --set ana.activated[+] threadJoins --disable ana.thread.include-node --set ana.thread.domain plain
#include <pthread.h>
#include <assert.h>

int g = 0;

void *t_fun(void *arg) {
  g++; // RACE!
  return NULL;
}

int main() {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  __goblint_assume_join(id); // should add to must-joined

  pthread_create(&id, NULL, t_fun, NULL); // should remove from must-joined again

  g++; // RACE!

  return 0;
}

Add threadJoins test where recreated threads should be removed from must-join set


/*
 * TEST: Run copyin and copyout on a user-defined type with two members
 * DIM: 3
 * PRIORITY: 1
 */

#include <stdio.h>
#include "physis/physis.h"

#define N 32
#define ITER 10

struct Point {
  float x;
  float y;
};

DeclareGrid3D(Point, struct Point);

void check(struct Point *in, struct Point *out) {
  int x = 0;
  size_t nelms = N*N*N;
  for (x = 0; x < nelms; ++x) {
    if (in[x].x != out[x].x) {
      fprintf(stderr, "Error: x mismatch at %d, in: %f, out: %f\n",
              x, in[x].x, out[x].x);
      exit(1);
    }
    if (in[x].y != out[x].y) {
      fprintf(stderr, "Error: y mismatch at %d, in: %f, out: %f\n",
              x, in[x].y, out[x].y);
      exit(1);
    }
  }
}

int main(int argc, char *argv[]) {
  PSInit(&argc, &argv, 3, N, N, N);
  PSGrid3DPoint g1 = PSGrid3DPointNew(N, N, N);
  size_t nelms = N*N*N;
  struct Point *indata = (struct Point *)malloc(
      sizeof(struct Point) * nelms);
  int i;
  for (i = 0; i < nelms; i++) {
    indata[i].x = i;
    indata[i].y = i+1;
  }
  struct Point *outdata = (struct Point *)malloc(
      sizeof(struct Point) * nelms);

  PSGridCopyin(g1, indata);
  PSGridCopyout(g1, outdata);

  check(indata, outdata);

  PSGridFree(g1);
  PSFinalize();
  free(indata);
  free(outdata);
  return 0;
}

Add a new simple test case for user-defined types


// Test that clang produces the __apple accelerator tables,
// e.g., __apple_types, correctly.
// RUN: %clang %s -target x86_64-apple-macosx10.13.0 -c -g -o %t-ex
// RUN: llvm-objdump -section-headers %t-ex | FileCheck %s

int main (int argc, char const *argv[]) { return argc; }

// CHECK: __debug_str
// CHECK-NEXT: __debug_abbrev
// CHECK-NEXT: __debug_info
// CHECK-NEXT: __debug_ranges
// CHECK-NEXT: __debug_macinfo
// CHECK-NEXT: __apple_names
// CHECK-NEXT: __apple_objc
// CHECK-NEXT: __apple_namespac
// CHECK-NEXT: __apple_types

[Darwin] Add a test to check clang produces accelerator tables.

This test was previously in lldb, and was only checking that clang
was emitting the correct section. So, it belongs here and not
in the debugger.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@325850 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef __BOARD_H
#define __BOARD_H

#ifdef __cplusplus
extern "C" {
#endif

#define F_OSC0 12000000UL
#define F_OSC1 0UL

#define F_CPU 66000000UL

#define HSBMASK_DEFAULT 0xFFFFFFFF
#define PBAMASK_DEFAULT 0xFFFFFFFF
#define PBBMASK_DEFAULT 0xFFFFFFFF

void init_board(void);

#ifdef __cplusplus
}
#endif

#endif

#ifndef __BOARD_H
#define __BOARD_H

#ifdef __cplusplus
extern "C" {
#endif

#define ADC_VREF 3.0
#define ADC_BITS 10

#define F_CPU 66000000UL
#define F_OSC0 12000000UL
#define F_OSC1 0UL

#define HSBMASK_DEFAULT 0xFFFFFFFF
#define PBAMASK_DEFAULT 0xFFFFFFFF
#define PBBMASK_DEFAULT 0xFFFFFFFF

void init_board(void);

static inline double cnv2volt(uint16_t cnv)
{
	return cnv * (ADC_VREF / (1U << ADC_BITS));
}

#ifdef __cplusplus
}
#endif

#endif

Add adc settings and a function to calculate the conversion


#include "queue.h"

struct Queue
{
	size_t head;
	size_t tail;
	size_t size;
	void** e;
};

Queue* Queue_Create(size_t n)
{
	Queue* q = (Queue *)malloc(sizeof(Queue));
	q->size = n;
	q->head = q->tail = 1;
	q->e = (void **)malloc(sizeof(void*) * (n + 1));
}

#include "queue.h"

struct Queue
{
	size_t head;
	size_t tail;
	size_t size;
	void** e;
};

Queue* Queue_Create(size_t n)
{
	Queue* q = (Queue *)malloc(sizeof(Queue));
	q->size = n;
	q->head = q->tail = 1;
	q->e = (void **)malloc(sizeof(void*) * (n + 1));
	return q;
}

Add missing return after Queue creation

Add missing return after Queue creation


/* vi: set sw=4 ts=4: */
/*
 * getrusage() for uClibc
 *
 * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
 *
 * GNU Library General Public License (LGPL) version 2 or later.
 */

#include "syscalls.h"
#include <unistd.h>
#include <wait.h>
_syscall2(int, getrusage, int, who, struct rusage *, usage);

/* vi: set sw=4 ts=4: */
/*
 * getrusage() for uClibc
 *
 * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
 *
 * GNU Library General Public License (LGPL) version 2 or later.
 */

#include "syscalls.h"
#include <unistd.h>
#include <wait.h>
_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage);

Correct type, gcc-3.4.5 fails, thanks nitinkg for reporting/testing


#ifndef __PTHREAD_H
#define __PTHREAD_H

typedef ULONG pthread_key_t;
typedef HANDLE pthread_mutex_t;
typedef int pthread_once_t;

DWORD		pthread_self(void);

void		pthread_setspecific(pthread_key_t, void *);
void	   *pthread_getspecific(pthread_key_t);

void		pthread_mutex_init(pthread_mutex_t *, void *attr);
void		pthread_mutex_lock(pthread_mutex_t *);

/* blocking */
void		pthread_mutex_unlock(pthread_mutex_t *);

#endif

#ifndef __PTHREAD_H
#define __PTHREAD_H

typedef ULONG pthread_key_t;
typedef HANDLE pthread_mutex_t;
typedef int pthread_once_t;

DWORD		pthread_self(void);

void		pthread_setspecific(pthread_key_t, void *);
void	   *pthread_getspecific(pthread_key_t);

int			pthread_mutex_init(pthread_mutex_t *, void *attr);
int			pthread_mutex_lock(pthread_mutex_t *);

/* blocking */
int			pthread_mutex_unlock(pthread_mutex_t *);

#endif

Fix declarations of pthread functions, missed in recent commit.


#include <stdint.h>

#include "readstat_xport.h"
#include "../readstat_bits.h"

char _xport_months[12][4] = {
    "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
    "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };

void xport_namestr_bswap(xport_namestr_t *namestr) {
    if (!machine_is_little_endian())
        return;

    namestr->ntype = byteswap2(namestr->ntype);
    namestr->nhfun = byteswap2(namestr->nhfun);
    namestr->nlng = byteswap2(namestr->nlng);
    namestr->nvar0 = byteswap2(namestr->nlng);

    namestr->nfl = byteswap2(namestr->nfl);
    namestr->nfd = byteswap2(namestr->nfd);
    namestr->nfj = byteswap2(namestr->nfj);

    namestr->nifl = byteswap2(namestr->nifl);
    namestr->nifd = byteswap2(namestr->nifd);
    namestr->npos = byteswap4(namestr->npos);

    namestr->labeln  = byteswap2(namestr->labeln);
}

#include <stdint.h>

#include "readstat_xport.h"
#include "../readstat_bits.h"

char _xport_months[12][4] = {
    "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
    "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };

void xport_namestr_bswap(xport_namestr_t *namestr) {
    if (!machine_is_little_endian())
        return;

    namestr->ntype = byteswap2(namestr->ntype);
    namestr->nhfun = byteswap2(namestr->nhfun);
    namestr->nlng = byteswap2(namestr->nlng);
    namestr->nvar0 = byteswap2(namestr->nvar0);

    namestr->nfl = byteswap2(namestr->nfl);
    namestr->nfd = byteswap2(namestr->nfd);
    namestr->nfj = byteswap2(namestr->nfj);

    namestr->nifl = byteswap2(namestr->nifl);
    namestr->nifd = byteswap2(namestr->nifd);
    namestr->npos = byteswap4(namestr->npos);

    namestr->labeln  = byteswap2(namestr->labeln);
}

Fix bug in XPORT byteswapping

Fix bug in XPORT byteswapping


#include <unistd.h>
#include <stdlib.h>
#include <sys/socket.h>

int main(void) {
  char const *server_path = "/tmp/unix_server_listener"

  int listener = socket(PF_UNIX, SOCK_STREAM, 0);

  unlink(server_path);
  int err = bind(listener, address);

  err = listen(listener, 2048);

  set listener close-on-fork

  int pid = fork();
  if (pid > 0) {
    // in child

    int client = socket(PF_UNIX, SOCK_STREAM, 0);

    int err = connect(client, address);

    exit(0);
  }

  if (pid == -1) {
    // err
    exit(1)
  }

  int connection = accept(listener);

  wait for readability

  attempt read

  return 0;
}

Add skeleton of test program

Add skeleton of test program


/* Author: Wietse Venema, Eindhoven University of Technology. */

#include <stdio.h>
#include <pwd.h>

#include <skey.h>

/* skey_challenge - additional password prompt stuff */

char   *skey_challenge(name, pwd, pwok)
char   *name;
struct passwd *pwd;
int     pwok;
{
    static char buf[128];
    struct skey skey;

    /* Display s/key challenge where appropriate. */

    if (pwd == 0 || skeychallenge(&skey, pwd->pw_name, buf) != 0)
	sprintf(buf, "Password required for %s.", name);
    return (buf);
}

Put skey support to ftpd Reviewed by: Submitted by: guido


// Public domain. See "unlicense" statement at the end of this file.

#define TA_ERROR_FAILED_TO_PARSE_CMDLINE        -1
#define TA_ERROR_FAILED_TO_CREATE_GAME_CONTEXT  -2
#define TA_ERROR_INVALID_ARGS                   -3

// Public domain. See "unlicense" statement at the end of this file.

typedef int ta_result;
#define TA_SUCCESS           0
#define TA_ERRORS           -1
#define TA_INVALID_ARGS     -2
#define TA_OUT_OF_MEMORY    -3

#define TA_ERROR_FAILED_TO_PARSE_CMDLINE        -1
#define TA_ERROR_FAILED_TO_CREATE_GAME_CONTEXT  -2
#define TA_ERROR_INVALID_ARGS                   -3

Add a few result codes.

Add a few result codes.


// Copyright 2019 DeepMind Technologies Limited.
//
// 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 REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_

#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"

namespace deepmind {
namespace reverb {
namespace pybind {

void ImportNumpy();

tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
                                   PyObject **out_ndarray);

tensorflow::Status NdArrayToTensor(PyObject *ndarray,
                                   tensorflow::Tensor *out_tensor);

tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
                                          PyArray_Descr **out_descr);

}  // namespace pybind
}  // namespace reverb
}  // namespace deepmind

#endif  // REVERB_CC_CONVERSIONS_H_

// Copyright 2019 DeepMind Technologies Limited.
//
// 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 REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_

#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"

namespace deepmind {
namespace reverb {
namespace pybind {

// One MUST initialize Numpy, e.g. within the Pybind11 module definition before
// calling C Numpy functions.
// See https://pythonextensionpatterns.readthedocs.io/en/latest/cpp_and_numpy.html
void ImportNumpy();

tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
                                   PyObject **out_ndarray);

tensorflow::Status NdArrayToTensor(PyObject *ndarray,
                                   tensorflow::Tensor *out_tensor);

tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
                                          PyArray_Descr **out_descr);

}  // namespace pybind
}  // namespace reverb
}  // namespace deepmind

#endif  // REVERB_CC_CONVERSIONS_H_

Document why `ImportNumpy ` exists and when it should be used.

PiperOrigin-RevId: 474532725
Change-Id: I305a57456bcac3186389a733e16d962fcee99dee


#ifndef SCRIPTWINDOW_H
#define SCRIPTWINDOW_H

#include <stdint.h>

#include <QHash>
#include <QObject>
#include <QScriptValue>

class QScriptEngine;

class ScriptWindow : public QObject {

    Q_OBJECT

    public:
        explicit ScriptWindow(const QScriptValue &originalWindow, QObject *parent = 0);

        QScriptValue toScriptValue();

        Q_INVOKABLE int randomInt(int min = 0, int max = INT32_MAX) const;

        Q_INVOKABLE int setInterval(const QScriptValue &function, int delay);
        Q_INVOKABLE void clearInterval(int timerId);

        Q_INVOKABLE int setTimeout(const QScriptValue &function, int delay);
        Q_INVOKABLE void clearTimeout(int timerId);

    protected:
        virtual void timerEvent(QTimerEvent *event);

    private:
        QScriptEngine *m_engine;
        QScriptValue m_originalWindow;

        QHash<int, QScriptValue> m_intervalHash;
        QHash<int, QScriptValue> m_timeoutHash;
};

#endif // SCRIPTWINDOW_H

#ifndef SCRIPTWINDOW_H
#define SCRIPTWINDOW_H

#include <QHash>
#include <QObject>
#include <QScriptValue>

class QScriptEngine;

class ScriptWindow : public QObject {

    Q_OBJECT

    public:
        explicit ScriptWindow(const QScriptValue &originalWindow, QObject *parent = 0);

        QScriptValue toScriptValue();

        Q_INVOKABLE int randomInt(int min = 0, int max = 2147483647) const;

        Q_INVOKABLE int setInterval(const QScriptValue &function, int delay);
        Q_INVOKABLE void clearInterval(int timerId);

        Q_INVOKABLE int setTimeout(const QScriptValue &function, int delay);
        Q_INVOKABLE void clearTimeout(int timerId);

    protected:
        virtual void timerEvent(QTimerEvent *event);

    private:
        QScriptEngine *m_engine;
        QScriptValue m_originalWindow;

        QHash<int, QScriptValue> m_intervalHash;
        QHash<int, QScriptValue> m_timeoutHash;
};

#endif // SCRIPTWINDOW_H

Fix compile error on Amazon EC2.

Fix compile error on Amazon EC2.


/*
** Copyright 2002, Manuel J. Petit. All rights reserved.
** Distributed under the terms of the NewOS License.
*/

#include <stdio.h>
#include <dlfcn.h>

extern int fib(int);
extern void shared_hello(void);

int
main()
{
	void *freston;
	void *girlfriend;

	shared_hello();
	printf("%d %d %d %d %d %d\n", fib(0), fib(1), fib(2), fib(3), fib(4), fib(5));

	freston= dlopen("/boot/lib/girlfriend.so", RTLD_LAZY);
	girlfriend= dlsym(freston, "girlfriend");

	((void(*)(void))girlfriend)();

	return 0;
}

/*
** Copyright 2002, Manuel J. Petit. All rights reserved.
** Distributed under the terms of the NewOS License.
*/

#include <stdio.h>
#include <dlfcn.h>

extern int fib(int);
extern void shared_hello(void);

int
main()
{
	void *freston;
	void *girlfriend;

	shared_hello();
	printf("%d %d %d %d %d %d\n", fib(0), fib(1), fib(2), fib(3), fib(4), fib(5));

	freston= dlopen("/boot/lib/girlfriend.so", RTLD_NOW);
	girlfriend= dlsym(freston, "girlfriend");

	((void(*)(void))girlfriend)();

	return 0;
}

Fix serious bug. Should be RTLD_NOW... RTLD_LAZY does not work for getting a girlfriend.

git-svn-id: fb278a52ad97f7fbef074986829f2c6a2a3c4b34@547 c25cc9d1-44fa-0310-b259-ad778cb1d433


/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* APIs between calling firmware and vboot_reference
 *
 * DO NOT INCLUDE THE HEADERS BELOW DIRECTLY!  ONLY INCLUDE THIS FILE!
 */

#ifndef VBOOT_VB2_API_H_
#define VBOOT_VB2_API_H_

/* Standard APIs */
#include "../2lib/include/2api.h"

/*
 * Coreboot should not need access to vboot2 internals.  But right now it does.
 * At least this forces it to do so through a relatively narrow hole so vboot2
 * refactoring can continue.
 *
 * Please do not rip this into a wider hole, or expect this hole to continue.
 *
 * TODO: Make cleaner APIs to this stuff.
 */
#ifdef NEED_VB20_INTERNALS
#include "../2lib/include/2struct.h"
#endif

#endif  /* VBOOT_VB2_API_H_ */

Add official API header file

vboot2: Add official API header file

This is what other firmware should include.  Other firmware must NOT
attempt to include headers from deeper inside the vboot2
implementation; that will likely break as vboot2 is refactored.

BUG=chromium:423882
BRANCH=none
TEST=VBOOT2=1 make runtests

Change-Id: I63638b03bb108296fa5069e7cc32ee9e25183846
Signed-off-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233050
Reviewed-by: Bill Richardson <129945214b1d548d8e49b6c29c43094f8c78057f@chromium.org>


//
//  NewDatabasesImpl.h
//  KirinKit
//
//  Created by Douglas Hoskins on 04/10/2013.
//  Copyright (c) 2013 Future Platforms. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NSObject+Kirin.h"
#import "KirinGwtServiceStub.h"
#import "NewTransactionService.h"
#import <toNative/DatabaseAccessServiceNative.h>

@interface NewDatabaseAccessService : KirinGwtServiceStub<DatabaseAccessServiceNative>

@property (strong, nonatomic) NSMutableDictionary * DbForId;
@property (strong, nonatomic) NewTransactionService * NewTransactionService;
@end

//
//  NewDatabasesImpl.h
//  KirinKit
//
//  Created by Douglas Hoskins on 04/10/2013.
//  Copyright (c) 2013 Future Platforms. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NSObject+Kirin.h"
#import "KirinGwtServiceStub.h"
#import "NewTransactionService.h"
#import <toNative/DatabaseAccessServiceNative.h>
#import "KirinSynchronousExecute.h"

@interface NewDatabaseAccessService : KirinGwtServiceStub<DatabaseAccessServiceNative, KirinSynchronousExecute>

@property (strong, nonatomic) NSMutableDictionary * DbForId;
@property (strong, nonatomic) NewTransactionService * NewTransactionService;
@end

[ios]  Make KirinGwtServiceStub use KirinSynchronousExecute protocol


/// @file
/// @brief Defines global state annotation class.

#ifndef GLOBAL_STATE_ANNOTATION_H
#define GLOBAL_STATE_ANNOTATION_H

namespace fish_annotator {

/// Defines global state information for one image/frame.
struct GlobalStateAnnotation : public Serialization {
  /// Constructor.
  ///
  /// @param states Global states of this image/frame.
  GlobalStateAnnotation(std::map<std::string, bool> states);

  /// Default constructor.
  GlobalStateAnnotation();

  /// Writes to a property tree.
  ///
  /// @return Property tree constructed from the object.
  pt::ptree write() const override final;

  /// Reads from a property tree.
  ///
  /// @param tree Property tree to be read.
  void read(const pt::ptree &tree);

  /// Global states of this image/frame.
  std::map<std::string, bool> states_;
};

} // namespace fish_annotator

#endif // GLOBAL_STATE_ANNOTATION_H

Add global state annotation definitions

Add global state annotation definitions


// PARAM: --set ana.activated[+] var_eq --set ana.activated[+] symb_locks --set ana.activated[+] region --enable ana.sv-comp.enabled --set ana.specification "CHECK( init(main()), LTL(G ! call(reach_error())) )"

// creduced from ldv-linux-4.2-rc1/linux-4.2-rc1.tar.xz-43_2a-drivers--scsi--qla4xxx--qla4xxx.ko-entry_point.cil.out.i
// this program and params are really minimal, which produced a TD3 abort verify error, so don't simplify

int a;

void c();

void b() {
  c();
}

unsigned e() {
  int d;
  if (d)
    c();
  return;
}

void c() {
  int f;
  unsigned g = 0;

  do {
    g = e();
    if (a)
      return;

    do {
      f++;
    } while (f);

  } while (g);

  b();
}

int main() {
  b();
  return 0;
}

Add minimal creduced case where TD3 abort fails its verify


#include <math.h>
#include <stdio.h>

int main() {
    int a, b;
    float c, s = 0.0;

    while (scanf("%d %d %f", &a, &b, &c) != EOF) {
        s += c * b;
    }

    printf("VALOR A PAGAR: R$ %.2f\n", s);
}

Solve Simple Calculate in c

Solve Simple Calculate in c


//=============================================================================
// String.h
//=============================================================================
#ifndef SRC_STRING_H_
#define SRC_STRING_H_

#include "AutoReleasePool.h"
#include <string.h>
//-----------------------------------------------------------------------------
STRUCT String {
  const string str;
  const unsigned long size;
} String;
//-----------------------------------------------------------------------------
String StringOf(const string);
string newstring(AutoReleasePool*, unsigned long size);
String newString(AutoReleasePool*, unsigned long size);
string copystring(AutoReleasePool*, const string, unsigned long size);
String copyString(AutoReleasePool*, const String, unsigned long size);
String appendChar(AutoReleasePool*, const String, const CHAR, unsigned int increaseBy);
string joinstrings(AutoReleasePool*, const string, const string);
String joinStrings(AutoReleasePool*, const String, const String);
String trimStringToSize(AutoReleasePool*, const String);
unsigned int getAllocationCount();
//-----------------------------------------------------------------------------
#endif // SRC_STRING_H_
//-----------------------------------------------------------------------------

//=============================================================================
// String.h
//=============================================================================
#ifndef SRC_STRING_H_
#define SRC_STRING_H_

#include "AutoReleasePool.h"
#include <string.h>
//-----------------------------------------------------------------------------
STRUCT String {
  string str;
  unsigned long size;
} String;
//-----------------------------------------------------------------------------
String StringOf(const string);
string newstring(AutoReleasePool*, unsigned long size);
String newString(AutoReleasePool*, unsigned long size);
string copystring(AutoReleasePool*, const string, unsigned long size);
String copyString(AutoReleasePool*, const String, unsigned long size);
String appendChar(AutoReleasePool*, const String, const CHAR, unsigned int increaseBy);
string joinstrings(AutoReleasePool*, const string, const string);
String joinStrings(AutoReleasePool*, const String, const String);
String trimStringToSize(AutoReleasePool*, const String);
unsigned int getAllocationCount();
//-----------------------------------------------------------------------------
#endif // SRC_STRING_H_
//-----------------------------------------------------------------------------

Refactor - fix error in gcc compile

Refactor - fix error in gcc compile


#include "../../include/mid.h"
#include <SDL/SDL_error.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>

enum { Bufsz = 1024 };

static char curerr[Bufsz + 1];

void seterrstr(const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	snprintf(curerr, Bufsz + 1, fmt, ap);
	va_end(ap);
}

const char *miderrstr(void){
	int err = errno;

	if (curerr[0] != '\0') {
		static char retbuf[Bufsz + 1];
		strncpy(retbuf, curerr, Bufsz);
		retbuf[Bufsz] = '\0';
		curerr[0] = '\0';
		return retbuf;
	}

	const char *e = SDL_GetError();
	if(e[0] != '\0')
		return e;

	return strerror(err);
}

#include "../../include/mid.h"
#include <SDL/SDL_error.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>

enum { Bufsz = 1024 };

static char curerr[Bufsz + 1];

void seterrstr(const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	vsnprintf(curerr, Bufsz + 1, fmt, ap);
	va_end(ap);
}

const char *miderrstr(void){
	int err = errno;

	if (curerr[0] != '\0') {
		static char retbuf[Bufsz + 1];
		strncpy(retbuf, curerr, Bufsz);
		retbuf[Bufsz] = '\0';
		curerr[0] = '\0';
		return retbuf;
	}

	const char *e = SDL_GetError();
	if(e[0] != '\0')
		return e;

	return strerror(err);
}

Call vsnprintf instead of just snprintf.


/*
 * config-mem.h
 *
 * Copyright (c) 1996, 1997
 *	Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

#ifndef __config_mem_h
#define __config_mem_h

#if defined(HAVE_STRING_H)
#include <string.h>
#endif
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#endif
#if defined(HAVE_MEMORY_H)
#include <memory.h>
#endif
#if defined(HAVE_MMAP)
#include <sys/mman.h>
#endif

#if !defined(HAVE_MEMCPY)
void bcopy(void*, void*, size_t);
#define	memcpy(_d, _s, _n)	bcopy((_s), (_d), (_n))
#endif

#if !defined(HAVE_MEMMOVE)
/* use bcopy instead */
#define memmove(to,from,size)	bcopy((from),(to),(size))
#endif

#if !defined(HAVE_GETPAGESIZE)
#define	getpagesize()	8192
#endif

#endif

/*
 * config-mem.h
 *
 * Copyright (c) 1996, 1997
 *	Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

#ifndef __config_mem_h
#define __config_mem_h

#if defined(HAVE_STRING_H)
#include <string.h>
#endif
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#endif
#if defined(HAVE_MEMORY_H)
#include <memory.h>
#endif
#if defined(HAVE_MMAP)
#include <sys/types.h>
#include <sys/mman.h>
#endif

#if !defined(HAVE_MEMCPY)
void bcopy(void*, void*, size_t);
#define	memcpy(_d, _s, _n)	bcopy((_s), (_d), (_n))
#endif

#if !defined(HAVE_MEMMOVE)
/* use bcopy instead */
#define memmove(to,from,size)	bcopy((from),(to),(size))
#endif

#if !defined(HAVE_GETPAGESIZE)
#define	getpagesize()	8192
#endif

#endif

Fix build problem under FreeBSD.

Fix build problem under FreeBSD.


// MIT License

// Copyright (c) 2017 Zhuhao Wang

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include <boost/asio.hpp>

namespace nekit {
namespace utils {

class AsyncIoInterface {
 public:
  explicit AsyncIoInterface(boost::asio::io_service& io) : io_{&io} {};
  ~AsyncIoInterface() = default;

  boost::asio::io_service& io() const { return *io_; }

 private:
  boost::asio::io_service* io_;
};

}  // namespace utils
}  // namespace nekit

// MIT License

// Copyright (c) 2017 Zhuhao Wang

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include <boost/asio.hpp>

namespace nekit {
namespace utils {

class AsyncIoInterface {
 public:
  virtual ~AsyncIoInterface() = default;

  // It must be guaranteed that any `io_context` that will be returned by any
  // instances of this interface should not be released before all instances are
  // released.
  virtual boost::asio::io_context* io() = 0;
};

}  // namespace utils
}  // namespace nekit

Make AsyncIoInterface a pure interface

REFACTOR: Make AsyncIoInterface a pure interface


#ifndef KLETCH_MATH_PREFIX_H
#define KLETCH_MATH_PREFIX_H

#include <utility>
#include <tuple>
#include <iostream>
#include <limits>
#include "special_functions.h"

namespace kletch {

#ifdef KLETCH_USE_DOUBLES
    typedef double real;
#else
    typedef float real;
#endif

template <typename T>
inline constexpr real rl(T number) { return static_cast<real>(number); }

using std::swap;

typedef std::numeric_limits<double> double_limits;
typedef std::numeric_limits<float> float_limits;
typedef std::numeric_limits<real> real_limits;

} // namespace kletch

#endif // KLETCH_MATH_PREFIX_H

#ifndef KLETCH_MATH_PREFIX_H
#define KLETCH_MATH_PREFIX_H

#include <utility>
#include <tuple>
#include <iostream>
#include <limits>
#include "special_functions.h"

namespace kletch {

#ifdef KLETCH_WITH_DOUBLE
    typedef double real;
#else
    typedef float real;
#endif

template <typename T>
inline constexpr real rl(T number) { return static_cast<real>(number); }

using std::swap;

typedef std::numeric_limits<double> double_limits;
typedef std::numeric_limits<float> float_limits;
typedef std::numeric_limits<real> real_limits;

} // namespace kletch

#endif // KLETCH_MATH_PREFIX_H

Make ReferenceFresnelTest th config dependent


// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_
#define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_

/**
 * @file
 * @brief Unused Result Warning Macro for DIFs.
 */

// Header Extern Guard (so header can be used from C and C++)
#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

/**
 * Attribute for functions which return errors that must be acknowledged.
 *
 * This attribute must be used to mark all DIFs which return an error value of
 * some kind, to ensure that callers do not accidentally drop the error on the
 * ground.
 */
#define DIF_WARN_UNUSED_RESULT __attribute__((warn_unused_result))

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif  // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_

// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_
#define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_

/**
 * @file
 * @brief Unused Result Warning Macro for DIFs.
 */

// Header Extern Guard (so header can be used from C and C++)
#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

/**
 * Attribute for functions which return errors that must be acknowledged.
 *
 * This attribute must be used to mark all DIFs which return an error value of
 * some kind, to ensure that callers do not accidentally drop the error on the
 * ground.
 *
 * Normally, the standard way to drop such a value on the ground explicitly is
 * with the syntax `(void)expr;`, in analogy with the behavior of C++'s
 * `[[nodiscard]]` attribute.
 * However, GCC does not implement this, so the idiom `if (expr) {}` should be
 * used instead, for the time being.
 * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509.
 */
#define DIF_WARN_UNUSED_RESULT __attribute__((warn_unused_result))

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif  // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_

[dif] Add a comment explaining how to drop an error on the ground

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509, which
necessitates doing this in a non-standard, but still portable, manner.

Signed-off-by: Miguel Young de la Sota <71b8e7f4945fd97b98544cf897992af89646547a@google.com>


/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
 * see ossfuzz.sh for full license text.
*/

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#include "miniz.h"

static unsigned char buffer[256 * 1024] = { 0 };

int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
    unsigned long int buffer_length = sizeof(buffer);

    if (Z_OK != uncompress(buffer, &buffer_length, data, size)) return 0;

    return 0;
}

/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
 * see ossfuzz.sh for full license text.
*/

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#include "miniz.h"

int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
    unsigned long int buffer_length = 1;
    unsigned char *buffer = NULL;
    int z_status = 0;

    if (size > 0)
        buffer_length *= data[0];
    if (size > 1)
        buffer_length *= data[1];

    buffer = (unsigned char *)malloc(buffer_length);

    z_status = uncompress(buffer, &buffer_length, data, size);
    free(buffer);

    if (Z_OK != z_status)
        return 0;
    return 0;
}

Use variable size input buffer in uncompress fuzzer.


// PARAM: --set ana.int.interval true --enable exp.partition-arrays.enabled
#include<stdlib.h>
#include<assert.h>

int main(void) {
    int *r = malloc(5 * sizeof(int));

    r[3] = 2;

    assert(r[4] == 2);
    (* Here we only test our implementation. Concretely, accessing the uninitialised r[4] is undefined behavior.
    In our implementation we keep the whole memory allocated by malloc as one Blob and the whole Blob contains 2 after it was assigned to r[3].
    This is more useful than keeping the Blob unknown. *)
}

// PARAM: --set ana.int.interval true --enable exp.partition-arrays.enabled
#include<stdlib.h>
#include<assert.h>

int main(void) {
    int *r = malloc(5 * sizeof(int));

    r[3] = 2;

    assert(r[4] == 2);
    /* Here we only test our implementation. Concretely, accessing the uninitialised r[4] is undefined behavior.
    In our implementation we keep the whole memory allocated by malloc as one Blob and the whole Blob contains 2 after it was assigned to r[3].
    This is more useful than keeping the Blob unknown. */
}

Mark the comment in a proper C style

Mark the comment in a proper C style


#ifndef BROTHERKH930_H_
#define BROTHERKH930_H_

#import "position.h"

/** Pins unsed for interfacing with the BrotherKH930. */
struct PinSetup {
  int encoderV1;
  int encoderV2;
  int encoderBP; // belt-phase
};

/** Pin setup as used by the KniticV2 PCB. */
PinSetup kniticV2Pins();

/**
 * Interfact to a brother knitting machine KH930/940.
 * The callback will be called on every event (position/direction change).
 */
class BrotherKH930 {
public:
  BrotherKH930(const PinSetup pins, void (*callback)(void*), void* context);

  int position();
  Direction direction();

private:
  static void positionCallback(void* context, int pos);
  void onChange();
private:
  Position *pos;
private:
  void (*callback)(void*);
  void* callbackContext;
};

#endif

#ifndef BROTHERKH930_H_
#define BROTHERKH930_H_

#import "position.h"

/** Pins unsed for interfacing with the BrotherKH930. */
struct PinSetup {
  int encoderV1;
  int encoderV2;
  int encoderBP; // belt-phase
};

/** Pin setup as used by the KniticV2 PCB. */
PinSetup kniticV2Pins();

/**
 * Interfact to a brother knitting machine KH930/940.
 * The callback will be called on every event (position/direction change). The
 * callback might be called in a ISR.
 */
class BrotherKH930 {
public:
  BrotherKH930(const PinSetup pins, void (*callback)(void*), void* context);

  int position();
  Direction direction();

private:
  static void positionCallback(void* context, int pos);
  void onChange();
private:
  Position *pos;
private:
  void (*callback)(void*);
  void* callbackContext;
};

#endif

Add comment regarding ISR in callback.

Add comment regarding ISR in callback.


// RUN: clang -checker-simple -verify %s &&
// RUN: clang -checker-simple -analyzer-store-region -verify %s

struct FPRec {
  void (*my_func)(int * x);
};

int bar(int x);

int f1_a(struct FPRec* foo) {
  int x;
  (*foo->my_func)(&x);
  return bar(x)+1; // no-warning
}

int f1_b() {
  int x;
  return bar(x)+1;  // expected-warning{{Pass-by-value argument in function is undefined.}}
}

int f2() {

  int x;

  if (x+1)  // expected-warning{{Branch}}
    return 1;

  return 2;
}

int f2_b() {
  int x;

  return ((x+1)+2+((x))) + 1 ? 1 : 2; // expected-warning{{Branch}}
}

int f3(void) {
  int i;
  int *p = &i;
  if (*p > 0) // expected-warning{{Branch condition evaluates to an uninitialized value}}
    return 0;
  else
    return 1;
}

int ret_uninit() {
  int i;
  int *p = &i;
  return *p;  // expected-warning{{Uninitialized or undefined return value returned to caller.}}
}

Add checker test case: warn about returning an uninitialized value to the caller.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@59765 91177308-0d34-0410-b5e6-96231b3b80d8


#define GAMMA 2.2

vec4 toLinear(vec4 colour)
{
	return vec4(pow(colour.rgb, vec3(GAMMA)), colour.a);
}

vec4 toSRGB(vec4 colour)
{
	return vec4(pow(colour.rgb, vec3(1.0 / GAMMA)), colour.a);
}

#define GAMMA 2.4

float toLinear(float color)
{
	return color <= 0.04045 ? (color / 12.92) : pow((color + 0.055) / 1.055, GAMMA);
}

vec4 toLinear(vec4 colour)
{
	return vec4(toLinear(colour.r), toLinear(colour.g), toLinear(colour.b), colour.a);
}

float toSRGB(float color)
{
	return color < 0.0031308 ? (12.92 * color) : (1.055 * pow(color, 1.0 / GAMMA) - 0.055);
}

vec4 toSRGB(vec4 colour)
{
	return vec4(toSRGB(colour.r), toSRGB(colour.g), toSRGB(colour.b), colour.a);

	// The following implementation using mix and step may be faster, but stackoverflow indicates it is in fact a lot slower on some GPUs.
	//return vec4(mix(colour.rgb * 12.92, 1.055 * pow(colour.rgb, vec3(1.0 / GAMMA)) - vec3(0.055), step(0.0031308, colour.rgb)), colour.a);
}

Convert to sRGB based on the appropriate formulas instead of an approximiate 2.2 gamma correction.


//===-- Endian.h ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_host_endian_h_
#define liblldb_host_endian_h_

#include "lldb/lldb-enumerations.h"

namespace lldb {

namespace endian {

    static union EndianTest
    {
        uint32_t num;
        uint8_t  bytes[sizeof(uint32_t)];
    } const endianTest = { (uint16_t)0x01020304 };

    inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }

//    ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
}

}

#endif  // liblldb_host_endian_h_

//===-- Endian.h ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_host_endian_h_
#define liblldb_host_endian_h_

#include "lldb/lldb-enumerations.h"

namespace lldb {

namespace endian {

    static union EndianTest
    {
        uint32_t num;
        uint8_t  bytes[sizeof(uint32_t)];
    } const endianTest = { 0x01020304 };

    inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }

//    ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
}

}

#endif  // liblldb_host_endian_h_

Fix endian test for big-endian hosts

Fix endian test for big-endian hosts

The uint16_t cast truncated the magic value to 0x00000304, making the
first byte 0 (eByteOrderInvalid) on big endian hosts.

Reported by Justin Hibbits.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@213861 91177308-0d34-0410-b5e6-96231b3b80d8


/**
 *  @copyright Copyright 2016 The J-PET Framework Authors. All rights reserved.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may find a copy of the License in the LICENCE file.
 *
 *  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.
 *
 *  @file JPetReaderInterface.h
 */

#ifndef JPETREADERINTERFACE_H
#define JPETREADERINTERFACE_H

#include <TNamed.h> // for Event typedef

class JPetReaderInterface {
 public:
  typedef TObject MyEvent;
  virtual ~JPetReaderInterface() {;}
  virtual MyEvent& getCurrentEvent()=0;
  virtual bool nextEvent()=0;
  virtual bool firstEvent()=0;
  virtual bool lastEvent()=0;
  virtual bool nthEvent(int n)=0;
  virtual long long getCurrentEventNumber() const =0;
  virtual long long getNbOfAllEvents() const =0;
  virtual TObject* getObjectFromFile(const char* name)=0;

  virtual bool openFileAndLoadData(const char* filename, const char* treename)=0;
  virtual void closeFile()=0;
};
#endif /*  !JPETREADERINTERFACE_H */

/**
 *  @copyright Copyright 2016 The J-PET Framework Authors. All rights reserved.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may find a copy of the License in the LICENCE file.
 *
 *  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.
 *
 *  @file JPetReaderInterface.h
 */

#ifndef JPETREADERINTERFACE_H
#define JPETREADERINTERFACE_H

#include <TNamed.h> // for Event typedef

class JPetReaderInterface {
 public:
  typedef TObject MyEvent;
  virtual ~JPetReaderInterface() {;}
  virtual MyEvent& getCurrentEvent()=0;
  virtual bool nextEvent()=0;
  virtual bool firstEvent()=0;
  virtual bool lastEvent()=0;
  virtual bool nthEvent(long long int n)=0;
  virtual long long getCurrentEventNumber() const =0;
  virtual long long getNbOfAllEvents() const =0;
  virtual TObject* getObjectFromFile(const char* name)=0;

  virtual bool openFileAndLoadData(const char* filename, const char* treename)=0;
  virtual void closeFile()=0;
};
#endif /*  !JPETREADERINTERFACE_H */

Change int to long long

Change int to long long


/*
 * =====================================================================================
 *
 *                      Copyright 2015 Manoel Vilela
 *
 *
 *       Filename: solution_1.c
 *
 *    Description: Solution for Problem031 of ProjectEuler
 *
 *         Author: Manoel Vilela
 *        Contact: manoel_vilela@engineer.com
 *   Organization: UFPA
 *     Perfomance: 0.02s | Intel E7400 @ 3.5Ghz
 *
 * =====================================================================================
**/

#include <stdio.h>
#define N_COINS 8

int different_ways(int money, int *coins, int n_coins) {
    int max_coin = money / (*coins);
    int n, ways = 0;
    for (n = 0; n <= max_coin; n++) {
        int new_money = (*coins) * n;

        if (n_coins > 1 && new_money < money)
            ways += different_ways(money - new_money, coins + 1, n_coins - 1);

        if (new_money == money) {
            ways++;
            break;
        }
    }

    return ways;
}

int main(int argc, char **argv){
    int coins[N_COINS] = {200, 100, 50, 20, 10, 5, 2, 1};
    int money = 200;
    int answer = different_ways(money, coins, N_COINS);

    printf("%d\n", answer);
    return 0;
}

/*
 * =====================================================================================
 *
 *                      Copyright 2015 Manoel Vilela
 *
 *
 *       Filename: solution_1.c
 *
 *    Description: Solution for Problem031 of ProjectEuler
 *
 *         Author: Manoel Vilela
 *        Contact: manoel_vilela@engineer.com
 *   Organization: UFPA
 *     Perfomance: 0.02s | Intel E7400 @ 3.5Ghz
 *
 * =====================================================================================
**/

#include <stdio.h>

int different_ways(int money, int *coins, int n_coins) {
    int max_coin = money / (*coins);
    int n, ways = 0;
    for (n = 0; n <= max_coin; n++) {
        int new_money = (*coins) * n;

        if (n_coins > 1 && new_money < money)
            ways += different_ways(money - new_money, coins + 1, n_coins - 1);

        if (new_money == money) {
            ways++;
            break;
        }
    }

    return ways;
}

int main(int argc, char **argv){
    int coins[] = {200, 100, 50, 20, 10, 5, 2, 1};
    int lenght = sizeof(coins) / sizeof(int);
    int money = 200;
    int answer = different_ways(money, coins, lenght);

    printf("%d\n", answer);
    return 0;
}

Remove the unecessary macro N_COINS to sizeof-way


/* The tarval module fails to negate the constant and returns TV_OVERFLOW_BAD
 * when optimising the comparison (-x < 0  ->  x > 0). It is not expected that
 * the negation fails and an assertion while constructing the negated constant
 * is triggered */

int f(double x)
{
	return -x < 0;
}

int main(void)
{
	return 0;
}

Add a test case where the tarval module generates an unexpected result.

[r14777]


#pragma once
#include "cocos2d.h"
#include "MoveAbleElem.h"

class MoveAbleElemBaseFactory :public cocos2d::Ref
{
protected:
	MoveAbleElemBaseFactory() { ; }
public:

	virtual ~MoveAbleElemBaseFactory()
	{

	}

	virtual bool init()
	{
		return true;
	}

	static MoveAbleElemBaseFactory * create()
	{
		return nullptr;
	}

	virtual MoveAbleElem * getMoveAbleElem()
	{
		return nullptr;
	}

	virtual void recycleElem(MoveAbleElem * pElem)
	{
	}

protected:
	cocos2d::Vector<MoveAbleElem *> _vUsedElem;
	cocos2d::Vector<MoveAbleElem *> _vReadyElem;

private:

};

Add base factory to produce moveAbleElem


#ifndef APIMOCK_H
#define APIMOCK_H

#include "core/exceptions.h"

#include "http/httpserver.h"
#include "http/requestdata.h"
#include "http/requestdata.h"
#include "http/statuscodes.h"

#include "routing/routedresourcestrategy.h"

#endif

#ifndef APIMOCK_H
#define APIMOCK_H

#include "core/exceptions.h"

#include "http/httpserver.h"
#include "http/requestdata.h"
#include "http/requestdata.h"
#include "http/statuscodes.h"

#include "routing/config.h"
#include "routing/routedresourcestrategy.h"

#endif

Include route configuration file in main header


#define BUILD_VDSO32

#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
#undef CONFIG_OPTIMIZE_INLINING
#endif

#undef CONFIG_X86_PPRO_FENCE

#ifdef CONFIG_X86_64

/*
 * in case of a 32 bit VDSO for a 64 bit kernel fake a 32 bit kernel
 * configuration
 */
#undef CONFIG_64BIT
#undef CONFIG_X86_64
#undef CONFIG_ILLEGAL_POINTER_VALUE
#undef CONFIG_SPARSEMEM_VMEMMAP
#undef CONFIG_NR_CPUS

#define CONFIG_X86_32 1
#define CONFIG_PAGE_OFFSET 0
#define CONFIG_ILLEGAL_POINTER_VALUE 0
#define CONFIG_NR_CPUS 1

#define BUILD_VDSO32_64

#endif

#include "../vclock_gettime.c"

#define BUILD_VDSO32

#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
#undef CONFIG_OPTIMIZE_INLINING
#endif

#undef CONFIG_X86_PPRO_FENCE

#ifdef CONFIG_X86_64

/*
 * in case of a 32 bit VDSO for a 64 bit kernel fake a 32 bit kernel
 * configuration
 */
#undef CONFIG_64BIT
#undef CONFIG_X86_64
#undef CONFIG_PGTABLE_LEVELS
#undef CONFIG_ILLEGAL_POINTER_VALUE
#undef CONFIG_SPARSEMEM_VMEMMAP
#undef CONFIG_NR_CPUS

#define CONFIG_X86_32 1
#define CONFIG_PGTABLE_LEVELS 2
#define CONFIG_PAGE_OFFSET 0
#define CONFIG_ILLEGAL_POINTER_VALUE 0
#define CONFIG_NR_CPUS 1

#define BUILD_VDSO32_64

#endif

#include "../vclock_gettime.c"

Define PGTABLE_LEVELS to 32bit VDSO

x86/vdso32: Define PGTABLE_LEVELS to 32bit VDSO

In case of CONFIG_X86_64, vdso32/vclock_gettime.c fakes a 32-bit
non-PAE kernel configuration by re-defining it to CONFIG_X86_32.
However, it does not re-define CONFIG_PGTABLE_LEVELS leaving it
as 4 levels.

This mismatch leads <asm/pgtable_type.h> to NOT include <asm-generic/
pgtable-nopud.h> and <asm-generic/pgtable-nopmd.h>, which will cause
compile errors when a later patch enhances <asm/pgtable_type.h> to
use PUD_SHIFT and PMD_SHIFT.  These -nopud & -nopmd headers define
these SHIFTs for the 32-bit non-PAE kernel.

Fix it by re-defining CONFIG_PGTABLE_LEVELS to 2 levels.

Signed-off-by: Toshi Kani <322b9f75d3806917607539efc168804d71b9503d@hpe.com>
Cc: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Cc: Juergen Gross <29bbaec13092d36559e3abc6f27f7d09c395819f@suse.com>
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@redhat.com>
Cc: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@alien8.de>
Cc: Konrad Wilk <da3a51b335cef0eb0e2c329c5ef6bcd6acef687a@oracle.com>
Cc: Robert Elliot <fcf6aac10c16bf4310224494560ff8cb9772fa2e@hpe.com>
Cc: eb778157e2286fdb10f8995701208f41dd1c36dc@kvack.org
Link: http://lkml.kernel.org/r/1442514264-12475-2-git-send-email-322b9f75d3806917607539efc168804d71b9503d@hpe.com
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>


/***********************************************************
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.

STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

******************************************************************/

/* Parser generator interface */

extern grammar gram;

extern grammar *meta_grammar PROTO((void));
extern grammar *pgen PROTO((struct _node *));

/***********************************************************
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.

STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

******************************************************************/

/* Parser generator interface */

extern grammar gram;

extern grammar *meta_grammar PROTO((void));

struct _node;
extern grammar *pgen PROTO((struct _node *));

Add declaration of struct _node, for scoping reasons.


/*
 * Copyright (c) 2018 Sippy Software, Inc., http://www.sippysoft.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

/*
 * Config parser helper callback function pointer alias
 */
typedef bool (*conf_helper_func)(const ucl_object_t *, const ucl_object_t *,
  void *);

/*
 * Config parser helper callback map. Maps UCL keys to callback functions that
 * parse the key and store the value in the correct struct member
 */
typedef struct conf_helper_callback_map {
    const char *conf_key;
    conf_helper_func callback;
} conf_helper_map;

struct conf_entry;

bool rtpp_ucl_set_unknown(const ucl_object_t *top,
  const ucl_object_t *obj, struct conf_entry *target __unused);

Add some UCL-related definitions to be shared by the RTPP code.


//
//  OCTCommitComment.h
//  OctoKit
//
//  Created by Justin Spahr-Summers on 2012-10-02.
//  Copyright (c) 2012 GitHub. All rights reserved.
//

#import "OCTObject.h"

// A single comment on a commit.
@interface OCTCommitComment : OCTObject

// The webpage URL for this comment.
@property (nonatomic, copy, readonly) NSURL *HTMLURL;

// The SHA of the commit being commented upon.
@property (nonatomic, copy, readonly) NSString *commitSHA;

// The login of the user who created this comment.
@property (nonatomic, copy, readonly) NSString *commenterLogin;

// The path of the file being commented on.
@property (nonatomic, copy, readonly) NSString *path;

// The body of the commit comment.
@property (nonatomic, copy, readonly) NSString *body;

// The line index in the commit's diff.
@property (nonatomic, copy, readonly) NSNumber *position;

@end

//
//  OCTCommitComment.h
//  OctoKit
//
//  Created by Justin Spahr-Summers on 2012-10-02.
//  Copyright (c) 2012 GitHub. All rights reserved.
//

#import "OCTObject.h"

// A single comment on a commit.
@interface OCTCommitComment : OCTObject

// The webpage URL for this comment.
@property (nonatomic, copy, readonly) NSURL *HTMLURL;

// The SHA of the commit being commented upon.
@property (nonatomic, copy, readonly) NSString *commitSHA;

// The login of the user who created this comment.
@property (nonatomic, copy, readonly) NSString *commenterLogin;

// The path of the file being commented on.
@property (nonatomic, copy, readonly) NSString *path;

// The body of the commit comment.
@property (nonatomic, copy, readonly) NSString *body;

// The line index in the commit's diff. This will be nil if the comment refers
// to the entire commit.
@property (nonatomic, copy, readonly) NSNumber *position;

@end

Document why position can be nil.

Document why position can be nil.