#ifndef MUDUO_BASE_ATOMIC_H
#define MUDUO_BASE_ATOMIC_H

#include <boost/noncopyable.hpp>

namespace muduo
{

class AtomicInt64 : boost::noncopyable
{
 public:
  AtomicInt64()
    : value_(0)
  {
  }

  int64_t get()
  {
    return value_;
  }

  int64_t addAndGet(int64_t x)
  {
    value_ += x;
    return value_;
  }

  int64_t incrementAndGet()
  {
    return addAndGet(1);
  }

  int64_t getAndSet(int64_t newValue)
  {
    int64_t old = value_;
    value_ = newValue;
    return old;
  }

 private:
  int64_t value_;
};

}
#endif  // MUDUO_BASE_ATOMIC_H

#ifndef MUDUO_BASE_ATOMIC_H
#define MUDUO_BASE_ATOMIC_H

#include <boost/noncopyable.hpp>

namespace muduo
{

class AtomicInt64 : boost::noncopyable
{
 public:
  AtomicInt64()
    : value_(0)
  {
  }

  int64_t get()
  {
    return value_;
  }

  int64_t addAndGet(int64_t x)
  {
    return __sync_add_and_fetch(&value_, x);
  }

  int64_t incrementAndGet()
  {
    return addAndGet(1);
  }

  int64_t getAndSet(int64_t newValue)
  {
    return __sync_lock_test_and_set(&value_, newValue);
  }

 private:
  volatile int64_t value_;
};

}
#endif  // MUDUO_BASE_ATOMIC_H

Implement atomic integer with gcc builtins.


// RUN: %llvmgcc %s -o - -S -emit-llvm -O3 | grep {i8 signext}
// PR1513

struct s{
long a;
long b;
};

void f(struct s a, char *b, char C) {

}

// RUN: %llvmgcc %s -o - -S -emit-llvm -O3 | grep {i8 signext}
// PR1513

struct s{
long a;
long b;
};

void f(struct s a, char *b, signed char C) {

}

Make this explictly signed. Fixes PR1571.

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


#ifndef _mitk_Video_Source_h_
#define _mitk_Video_Source_h_

#include "mitkCommon.h"
#include <itkObject.h>
#include "itkObjectFactory.h"

namespace mitk
{
  /**
  * Simple base class for acquiring video data.
  */
  class VideoSource //: public itk::Object
  {
    public:
      //mitkClassMacro( VideoSource, itk::Object );
      //itkNewMacro( Self );
      VideoSource();
	    virtual ~VideoSource();

      ////##Documentation
      ////## @brief assigns the grabbing devices for acquiring the next frame.
      virtual void FetchFrame();
      ////##Documentation
      ////## @brief returns a pointer to the image data array for opengl rendering.
      virtual unsigned char * GetVideoTexture();
      ////##Documentation
      ////## @brief starts the video capturing.
      virtual void StartCapturing();
      ////##Documentation
      ////## @brief stops the video capturing.
      virtual void StopCapturing();
      ////##Documentation
      ////## @brief returns true if video capturing is active.
      bool IsCapturingEnabled();

    protected:

      unsigned char * m_CurrentVideoTexture;
      int m_CaptureWidth, m_CaptureHeight;
      bool m_CapturingInProcess;

  };
}
#endif // Header

FIX warnings: newline at end of file

FIX warnings: newline at end of file


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

#ifndef LLVM_OPTION_OPTSPECIFIER_H
#define LLVM_OPTION_OPTSPECIFIER_H

namespace llvm {
namespace opt {
  class Option;

  /// OptSpecifier - Wrapper class for abstracting references to option IDs.
  class OptSpecifier {
    unsigned ID;

  private:
    explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION;

  public:
    OptSpecifier() : ID(0) {}
    /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {}
    /*implicit*/ OptSpecifier(const Option *Opt);

    bool isValid() const { return ID != 0; }

    unsigned getID() const { return ID; }

    bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
    bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
  };
}
}

#endif

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

#ifndef LLVM_OPTION_OPTSPECIFIER_H
#define LLVM_OPTION_OPTSPECIFIER_H

#include "llvm/Support/Compiler.h"

namespace llvm {
namespace opt {
  class Option;

  /// OptSpecifier - Wrapper class for abstracting references to option IDs.
  class OptSpecifier {
    unsigned ID;

  private:
    explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION;

  public:
    OptSpecifier() : ID(0) {}
    /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {}
    /*implicit*/ OptSpecifier(const Option *Opt);

    bool isValid() const { return ID != 0; }

    unsigned getID() const { return ID; }

    bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
    bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
  };
}
}

#endif

Add missing include, found by modules build.

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


#include <kernel/x86/lock.h>

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

#include <pthread.h>

static volatile int counter;
static mutex_t lock;

void *do_thread(void *arg) {
	int sign = (int)arg;

	for(int i = 0; i < 100000; i++) {
		wait_aquire(&lock);
		counter += sign;
		release(&lock);
	}

	return NULL;
}

void panic(char *s) {
	fprintf(stderr, "%s\n", s);
	exit(1);
}

int main(void) {
	pthread_t incr, decr;

	pthread_create(&incr, NULL, do_thread, (void *)1);
	pthread_create(&decr, NULL, do_thread, (void *)-1);

	pthread_join(incr, NULL);
	pthread_join(decr, NULL);

	if(counter != 0) {
		panic("Counter is non-zero!");
	}
	return 0;
}

#include <kernel/arch/lock.h>

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

#include <pthread.h>

static volatile int counter;
static mutex_t lock;

void *do_thread(void *arg) {
	int sign = (int)arg;

	for(int i = 0; i < 100000; i++) {
		wait_aquire(&lock);
		counter += sign;
		release(&lock);
	}

	return NULL;
}

void panic(char *s) {
	fprintf(stderr, "%s\n", s);
	exit(1);
}

int main(void) {
	pthread_t incr, decr;

	pthread_create(&incr, NULL, do_thread, (void *)1);
	pthread_create(&decr, NULL, do_thread, (void *)-1);

	pthread_join(incr, NULL);
	pthread_join(decr, NULL);

	if(counter != 0) {
		panic("Counter is non-zero!");
	}
	return 0;
}

Fix bitrotted include in test

Fix bitrotted include in test


/**
 * Copyright (c) 2015 Runtime Inc.
 *
 * 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.
 */

#include "hal/hal_gpio.h"

#include <stdio.h>

#define HAL_GPIO_NUM_PINS 8

static struct {
    int val;
    enum {
        INPUT,
        OUTPUT
    } dir;
} hal_gpio[HAL_GPIO_NUM_PINS];

int
gpio_init_in(int pin, gpio_pull_t pull)
{
    if (pin >= HAL_GPIO_NUM_PINS) {
        return -1;
    }
    hal_gpio[pin].dir = INPUT;
    switch (pull) {
    case GPIO_PULL_UP:
        hal_gpio[pin].val = 1;
        break;
    default:
        hal_gpio[pin].val = 0;
        break;
    }
    return 0;
}

int
gpio_init_out(int pin, int val)
{
    if (pin >= HAL_GPIO_NUM_PINS) {
        return -1;
    }
    hal_gpio[pin].dir = OUTPUT;
    hal_gpio[pin].val = (val != 0);
    return 0;
}

void
gpio_set(int pin)
{
    gpio_write(pin, 1);
}

void
gpio_clear(int pin)
{
    gpio_write(pin, 0);
}

void gpio_write(int pin, int val)
{
    if (pin >= HAL_GPIO_NUM_PINS) {
        return;
    }
    if (hal_gpio[pin].dir != OUTPUT) {
        return;
    }
    hal_gpio[pin].val = (val != 0);
    printf("GPIO %d is now %d\n", pin, val);
}

int
gpio_read(int pin)
{
    if (pin >= HAL_GPIO_NUM_PINS) {
        return -1;
    }
    return hal_gpio[pin].val;
}

void
gpio_toggle(int pin)
{
    gpio_write(pin, gpio_read(pin) != 1);
}

Add GPIO hal for simulator.

Add GPIO hal for simulator.


//===-- PosixApi.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_PosixApi_h
#define liblldb_Host_PosixApi_h

// This file defines platform specific functions, macros, and types necessary
// to provide a minimum level of compatibility across all platforms to rely
// on various posix api functionality.

#include "llvm/Support/Compiler.h"

#if defined(LLVM_ON_WIN32)
#include "lldb/Host/windows/PosixApi.h"
#endif

#endif

Add a newline to the end of the file to remove the clang warnings.

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


/*
 * LibCassandra
 * Copyright (C) 2010-2011 Padraig O'Sullivan, Ewen Cheslack-Postava
 * All rights reserved.
 *
 * Use and distribution licensed under the BSD license. See
 * the COPYING file in the parent directory for full text.
 */

#ifndef __LIBCASSANDRA_UTIL_PLATFORM_H
#define __LIBCASSANDRA_UTIL_PLATFORM_H

#include <boost/tr1/memory.hpp>
#include <boost/tr1/tuple.hpp>
#include <boost/tr1/unordered_map.hpp>

#include <string>
#include <vector>
#include <map>
#include <set>

#endif //__LIBCASSANDRA_UTIL_PLATFORM_H

/*
 * LibCassandra
 * Copyright (C) 2010-2011 Padraig O'Sullivan, Ewen Cheslack-Postava
 * All rights reserved.
 *
 * Use and distribution licensed under the BSD license. See
 * the COPYING file in the parent directory for full text.
 */

#ifndef __LIBCASSANDRA_UTIL_PLATFORM_H
#define __LIBCASSANDRA_UTIL_PLATFORM_H

#ifdef __GNUC__

// #include_next is broken: it does not search default include paths!
#define BOOST_TR1_DISABLE_INCLUDE_NEXT
// config_all.hpp reads this variable, then sets BOOST_HAS_INCLUDE_NEXT anyway
#include <boost/tr1/detail/config_all.hpp>
#ifdef BOOST_HAS_INCLUDE_NEXT
// This behavior has existed since boost 1.34, unlikely to change.
#undef BOOST_HAS_INCLUDE_NEXT
#endif

#endif
#endif

#include <boost/tr1/memory.hpp>
#include <boost/tr1/tuple.hpp>
#include <boost/tr1/unordered_map.hpp>

#include <string>
#include <vector>
#include <map>
#include <set>

#endif //__LIBCASSANDRA_UTIL_PLATFORM_H

Disable boost's include_next functionality, fixes compatibility with Sirikata.


#include <type_traits>

template<typename T>
struct is_config_type:std::integral_constant<bool,false>{};

template<> struct is_config_type <bool>:               std::integral_constant<bool,true>{};

template<> struct is_config_type <int>:                std::integral_constant<bool,true>{};
template<> struct is_config_type <long>:               std::integral_constant<bool,true>{};
template<> struct is_config_type <long long>:          std::integral_constant<bool,true>{};

template<> struct is_config_type <unsigned int>:       std::integral_constant<bool,true>{};
template<> struct is_config_type <unsigned long>:      std::integral_constant<bool,true>{};
template<> struct is_config_type <unsigned long long>: std::integral_constant<bool,true>{};

template<> struct is_config_type <float>:              std::integral_constant<bool,true>{};
template<> struct is_config_type <double>:             std::integral_constant<bool,true>{};
template<> struct is_config_type <long double>:        std::integral_constant<bool,true>{};

template<> struct is_config_type <std::string>:        std::integral_constant<bool,true>{};

#include <type_traits>

template<typename T>
struct is_config_type: std::false_type{};

template<> struct is_config_type <bool>:               std::true_type{};

template<> struct is_config_type <int>:                std::true_type{};
template<> struct is_config_type <long>:               std::true_type{};
template<> struct is_config_type <long long>:          std::true_type{};

template<> struct is_config_type <unsigned int>:       std::true_type{};
template<> struct is_config_type <unsigned long>:      std::true_type{};
template<> struct is_config_type <unsigned long long>: std::true_type{};

template<> struct is_config_type <float>:              std::true_type{};
template<> struct is_config_type <double>:             std::true_type{};
template<> struct is_config_type <long double>:        std::true_type{};

template<> struct is_config_type <std::string>:        std::true_type{};

Change integral_constant<bool> to true_type and false_type.


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 95
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 96
#endif

Update Skia milestone to 96

Update Skia milestone to 96

Change-Id: I635df8267340a9068b80a2e6c001958cfb2d10e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447578
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Reviewed-by: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.com>
Auto-Submit: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.com>


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 66
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 67
#endif

Update Skia milestone to 67

Update Skia milestone to 67

TBR: reed

Bug: skia:
Change-Id: I11a5515c41d5bb7ed95294fdb63668c35d14d960
Reviewed-on: https://skia-review.googlesource.com/111326
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2013 Couchbase, Inc.
 *
 *   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 SIGAR_VISIBILITY_H
#define SIGAR_VISIBILITY_H 1

#ifdef BUILDING_SIGAR

#if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define SIGAR_PUBLIC_API __global
#elif defined __GNUC__
#define SIGAR_PUBLIC_API __attribute__ ((visibility("default")))
#elif defined(_MSC_VER)
#define SIGAR_PUBLIC_API __declspec(dllexport)
#else
/* unknown compiler */
#define SIGAR_PUBLIC_API
#endif

#else

#if defined(_MSC_VER)
#define SIGAR_PUBLIC_API __declspec(dllimport)
#else
#define SIGAR_PUBLIC_API
#endif

#endif

#endif /* SIGAR_VISIBILITY_H */

/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2013 Couchbase, Inc.
 *
 *   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.
 */
#pragma once

#ifdef BUILDING_SIGAR

#if defined(__GNUC__)
#define SIGAR_PUBLIC_API __attribute__ ((visibility("default")))
#elif defined(_MSC_VER)
#define SIGAR_PUBLIC_API __declspec(dllexport)
#else
/* unknown compiler */
#define SIGAR_PUBLIC_API
#endif

#else

#if defined(_MSC_VER)
#define SIGAR_PUBLIC_API __declspec(dllimport)
#else
#define SIGAR_PUBLIC_API
#endif

#endif

Remove support for Sun Studio compiler

Remove support for Sun Studio compiler

Change-Id: I7fb2ac0cd9942fad79eb874604dc48e02a0d01db
Reviewed-on: https://review.couchbase.org/c/sigar/+/166582
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Paolo Cocchi <9dd88c9f3e5cbab6e19a6c020f107e0c648ac956@couchbase.com>


#include "resourceManager.h"
#include "kernelHeap.h"

//allocates frames
MemoryResource *create_memoryResource(unsigned int size)
{
    MemoryResource *memRes;

    memRes = kmalloc(sizeof(MemoryResource));

    return memRes;
}

#include "resourceManager.h"
#include "kernelHeap.h"

//allocates frames
MemoryResource *create_memoryResource(unsigned int size)
{
    MemoryResource *memRes;

    memRes = (MemoryResource*)kmalloc(sizeof(MemoryResource));

    return memRes;
}

Use type casts from void

Use type casts from void


#include "matrix.h"
#include <stdio.h>

enum datacols {
    _M = 1,
    _J0 = 2,
    _J1 = 3,
    _J2 = 5,
    _TAU1 = 4,
    _TAU2 = 6
};

double CreepLookup(char *file, double T, double M, int param)
{
    int i = 0;
    double M0, M1, y0, y1;
    matrix *data;

    data = mtxloadcsv(file, 1);

    while(val(data, i, _M) < M)
        i++;

    M0 = val(data, i-1, _M);
    M1 = val(data, i, _M);
    y0 = val(data, i-1, param);
    y1 = val(data, i, param);

    DestroyMatrix(data);
    return y0 + (y1 - y0) * (M-M0)/(M1-M0);
}

double CreepLookupJ0(char *f, double T, double M)
{ return CreepLookup(f, T, M, _J0); }
double CreepLookupJ1(char *f, double T, double M)
{ return CreepLookup(f, T, M, _J1); }
double CreepLookupJ2(char *f, double T, double M)
{ return CreepLookup(f, T, M, _J2); }
double CreepLookupTau1(char *f, double T, double M)
{ return CreepLookup(f, T, M, _TAU1); }
double CreepLookupTau2(char *f, double T, double M)
{ return CreepLookup(f, T, M, _TAU2); }

Add functions for linear interpolation of creep function parameters.


/* stacks.h
 *  Copyright: (When this is determined...it will go here)
 *  CVS Info
 *     $Id$
 *  Overview:
 *     Stack handling routines for Parrot
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#if !defined(PARROT_STACKS_H_GUARD)
#define PARROT_STACKS_H_GUARD

#include "parrot/parrot.h"

#define STACK_CHUNK_DEPTH 256

struct Stack_Entry {
    INTVAL entry_type;
    INTVAL flags;
    void (*cleanup)(struct Stack_Entry *);
    union {
        FLOATVAL num_val;
        INTVAL int_val;
        PMC *pmc_val;
        STRING *string_val;
        void *generic_pointer;
    } entry;
};

struct Stack {
  INTVAL used;
  INTVAL free;
  struct StackChunk *next;
  struct StackChunk *prev;
  struct Stack_Entry entry[STACK_CHUNK_DEPTH];
};

struct Stack_Entry *push_generic_entry(struct Perl_Interp *, void *thing, INTVAL type, void *cleanup);
void *pop_generic_entry(struct Perl_Interp *, void *where, INTVAL type);
void toss_geleric_entry(struct Perl_Interp *, INTVAL type);

#endif

/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
*/

/* stacks.h
 *  Copyright: (When this is determined...it will go here)
 *  CVS Info
 *     $Id$
 *  Overview:
 *     Stack handling routines for Parrot
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#if !defined(PARROT_STACKS_H_GUARD)
#define PARROT_STACKS_H_GUARD

#include "parrot/parrot.h"

#define STACK_CHUNK_DEPTH 256

struct Stack_Entry {
    INTVAL entry_type;
    INTVAL flags;
    void (*cleanup)(struct Stack_Entry *);
    union {
        FLOATVAL num_val;
        INTVAL int_val;
        PMC *pmc_val;
        STRING *string_val;
        void *generic_pointer;
    } entry;
};

struct Stack {
  INTVAL used;
  INTVAL free;
  struct StackChunk *next;
  struct StackChunk *prev;
  struct Stack_Entry entry[STACK_CHUNK_DEPTH];
};

struct Stack_Entry *push_generic_entry(struct Perl_Interp *, void *thing, INTVAL type, void *cleanup);
void *pop_generic_entry(struct Perl_Interp *, void *where, INTVAL type);
void toss_generic_entry(struct Perl_Interp *, INTVAL type);

#endif

/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
*/

Fix typo in function name

Fix typo in function name

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@255 d31e2699-5ff4-0310-a27c-f18f2fbe73fe


#ifndef MYSQL2_EXT
#define MYSQL2_EXT

void Init_mysql2(void);

/* tell rbx not to use it's caching compat layer
   by doing this we're making a promise to RBX that
   we'll never modify the pointers we get back from RSTRING_PTR */
#define RSTRING_NOT_MODIFIED
#include <ruby.h>

#ifdef HAVE_MYSQL_H
#include <mysql.h>
#include <mysql_com.h>
#include <errmsg.h>
#include <mysqld_error.h>
#else
#include <mysql/mysql.h>
#include <mysql/mysql_com.h>
#include <mysql/errmsg.h>
#include <mysql/mysqld_error.h>
#endif

#ifdef HAVE_RUBY_ENCODING_H
#include <ruby/encoding.h>
#endif
#ifdef HAVE_RUBY_THREAD_H
#include <ruby/thread.h>
#endif

#if defined(__GNUC__) && (__GNUC__ >= 3)
#define RB_MYSQL_NORETURN __attribute__ ((noreturn))
#define RB_MYSQL_UNUSED __attribute__ ((unused))
#else
#define RB_MYSQL_NORETURN
#define RB_MYSQL_UNUSED
#endif

#include <client.h>
#include <statement.h>
#include <result.h>
#include <infile.h>

#endif

#ifndef MYSQL2_EXT
#define MYSQL2_EXT

void Init_mysql2(void);

/* tell rbx not to use it's caching compat layer
   by doing this we're making a promise to RBX that
   we'll never modify the pointers we get back from RSTRING_PTR */
#define RSTRING_NOT_MODIFIED
#include <ruby.h>

#ifdef HAVE_MYSQL_H
#include <mysql.h>
#include <errmsg.h>
#include <mysqld_error.h>
#else
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
#include <mysql/mysqld_error.h>
#endif

#ifdef HAVE_RUBY_ENCODING_H
#include <ruby/encoding.h>
#endif
#ifdef HAVE_RUBY_THREAD_H
#include <ruby/thread.h>
#endif

#if defined(__GNUC__) && (__GNUC__ >= 3)
#define RB_MYSQL_NORETURN __attribute__ ((noreturn))
#define RB_MYSQL_UNUSED __attribute__ ((unused))
#else
#define RB_MYSQL_NORETURN
#define RB_MYSQL_UNUSED
#endif

#include <client.h>
#include <statement.h>
#include <result.h>
#include <infile.h>

#endif

Include mysql_com.h has been here for ages but was superfluous


#include "types.h"
#include "stat.h"
#include "user.h"

char buf[512];

void
cat(int fd)
{
  int n;

  while((n = read(fd, buf, sizeof(buf))) > 0)
    write(1, buf, n);
  if(n < 0){
    printf(1, "cat: read error\n");
    exit();
  }
}

int
main(int argc, char *argv[])
{
  int fd, i;

  if(argc <= 1){
    cat(0);
    exit();
  }

  for(i = 1; i < argc; i++){
    if((fd = open(argv[i], 0)) < 0){
      printf(1, "cat: cannot open %s\n", argv[i]);
      exit();
    }
    cat(fd);
    close(fd);
  }
  exit();
}

#include "types.h"
#include "stat.h"
#include "user.h"

char buf[512];

void
cat(int fd)
{
  int n;

  while((n = read(fd, buf, sizeof(buf))) > 0) {
    if (write(1, buf, n) != n) {
      printf(1, "cat: write error\n");
      exit();
    }
  }
  if(n < 0){
    printf(1, "cat: read error\n");
    exit();
  }
}

int
main(int argc, char *argv[])
{
  int fd, i;

  if(argc <= 1){
    cat(0);
    exit();
  }

  for(i = 1; i < argc; i++){
    if((fd = open(argv[i], 0)) < 0){
      printf(1, "cat: cannot open %s\n", argv[i]);
      exit();
    }
    cat(fd);
    close(fd);
  }
  exit();
}

Check result of write (thans to Alexander Kapshuk <alexander.kapshuk@gmail)


#define WORD (8 * sizeof(ulong))

#define clz(x) __builtin_clzl(x)

#define fls(x) (WORD - clz(x))

#define ffs(x) (__builtin_ctzl(x))

#define get(x, i) ((x) & (1 << (i)))

#define set(x, i) (x = (x) | (1 << (i)))

#define unset(x, i) (x = (x) & ~(1 << (i)))

#define WORD (8 * sizeof(ulong))

#define clz(x) __builtin_clzl(x)

#define fls(x) (WORD - clz(x))

#define ffs(x) (__builtin_ctzl(x))

#define get(x, i) ((x) & (1L << (i)))

#define set(x, i) (x = (x) | (1L << (i)))

#define unset(x, i) (x = (x) & ~(1L << (i)))

Fix to literal data types in the macros

Fix to literal data types in the macros

Thanks for Fu, Bing for noting.


#ifndef SAFE_H
#define SAFE_H

#include "debug.h"

#ifndef DISABLE_SAFE

#define SAFE_STRINGIFY(x) #x
#define SAFE_TOSTRING(x) SAFE_STRINGIFY(x)
#define SAFE_AT __FILE__ ":" SAFE_TOSTRING(__LINE__) ": "

#define SAFE_ASSERT(cond) do { \
  if (!(cond)) { \
    DEBUG_DUMP(0, "error: " SAFE_AT "%m"); \
    DEBUG_BREAK(!(cond)); \
  } \
} while (0)

#else
#define SAFE_ASSERT(...)
#endif

#include <stdint.h>

#define SAFE_NNCALL(call) do { \
  intptr_t ret = (intptr_t) (call); \
  SAFE_ASSERT(ret >= 0); \
} while (0)

#define SAFE_NZCALL(call) do { \
  intptr_t ret = (intptr_t) (call); \
  SAFE_ASSERT(ret != 0); \
} while (0)

#endif /* end of include guard: SAFE_H */

#ifndef SAFE_H
#define SAFE_H

#include "debug.h"

#ifndef DISABLE_SAFE

#define SAFE_STRINGIFY(x) #x
#define SAFE_TOSTRING(x) SAFE_STRINGIFY(x)
#define SAFE_AT __FILE__ ":" SAFE_TOSTRING(__LINE__) ": "

#define SAFE_ASSERT(cond) do { \
  if (!(cond)) { \
    DEBUG_DUMP(0, "error: " SAFE_AT "%m"); \
    DEBUG_BREAK(!(cond)); \
  } \
} while (0)

#else
#define SAFE_ASSERT(...)
#endif

#include <stdint.h>

#define SAFE_NNCALL(call) do { \
  intptr_t ret = (intptr_t) (call); \
  SAFE_ASSERT(ret >= 0); \
} while (0)

#define SAFE_NZCALL(call) do { \
  intptr_t ret = (intptr_t) (call); \
  SAFE_ASSERT(ret != 0); \
} while (0)

#define SAFE_RZCALL(call) do { \
  intptr_t ret = (intptr_t) (call); \
  SAFE_ASSERT(ret == 0); \
} while (0)

#endif /* end of include guard: SAFE_H */

Add SAFE_RZCALL to wrap calls that returns zero.


/** @file
  Copyright (C) 2016 CupertinoNet.  All rights reserved.<BR>

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

// Related definitions

// DARWIN_KERNEL_IMAGE_TYPE
enum {
  DarwinKernelImageTypeMacho       = 0,
  DarwinKernelImageTypeHibernation = 1
};

typedef UINTN DARWIN_KERNEL_IMAGE_TYPE;

// DARWIN_KERNEL_HEADER
typedef union {
  MACH_HEADER               *MachHeader;
  MACH_HEADER_64            *MachHeader64;
  IO_HIBERNATE_IMAGE_HEADER *HibernationImageHeader;
} DARWIN_KERNEL_HEADER;

// DARWIN_KERNEL_INFORMATION
typedef struct {
  DARWIN_KERNEL_IMAGE_TYPE ImageType;
  DARWIN_KERNEL_HEADER     Image;
} DARWIN_KERNEL_INFORMATION;

// DARWIN_KERNEL_DISCOVERED_CALLBACK
typedef
VOID
(EFIAPI *DARWIN_KERNEL_DISCOVERED_CALLBACK)(
  IN XNU_PHYSICAL_ADDRESS  KernelEntry
  );

// DARWIN_KERNEL_ENTRY_CALLBACK
typedef
VOID
(EFIAPI *DARWIN_KERNEL_ENTRY_CALLBACK)(
  VOID
  );

// Protocol definition

typedef DARWIN_KERNEL_PROTOCOL DARWIN_KERNEL_PROTOCOL;

// DARWIN_KERNEL_ADD_KERNEL_DISCOVERED_CALLBACK
typedef
EFI_STATUS
(EFIAPI *DARWIN_KERNEL_ADD_KERNEL_DISCOVERED_CALLBACK)(
  IN DARWIN_KERNEL_PROTOCOL             *This,
  IN DARWIN_KERNEL_DISCOVERED_CALLBACK  NotifyFunction
  );

// DARWIN_KERNEL_ADD_KERNEL_ENTRY_CALLBACK
typedef
EFI_STATUS
(EFIAPI *DARWIN_KERNEL_ADD_KERNEL_ENTRY_CALLBACK)(
  IN DARWIN_KERNEL_PROTOCOL        *This,
  IN DARWIN_KERNEL_ENTRY_CALLBACK  NotifyFunction
  );

// DARWIN_KERNEL_GET_IMAGE_INFORMATION
typedef
EFI_STATUS
(EFIAPI *DARWIN_KERNEL_GET_IMAGE_INFORMATION)(
  IN  DARWIN_KERNEL_PROTOCOL     *This,
  OUT DARWIN_KERNEL_INFORMATION  *KernelInformation
  );

// DARWIN_KERNEL_PROTOCOL
struct DARWIN_KERNEL_PROTOCOL {
  UINTN                                        Revision;
  DARWIN_KERNEL_ADD_KERNEL_DISCOVERED_CALLBACK AddKernelDiscoveredCallback;
  DARWIN_KERNEL_ADD_KERNEL_ENTRY_CALLBACK      AddKernelEntryCallback;
  DARWIN_KERNEL_GET_IMAGE_INFORMATION          GetImageInformation;
};

#endif // DARWIN_KERNEL_H_

Add proof-of-concept Kernel protocol header.


// PARAM: --set ana.activated[+] deadlock --set ana.activated[+] threadJoins
// From https://arxiv.org/abs/1607.06927
#include <pthread.h>

int x;
pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t m3 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t m4 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t m5 = PTHREAD_MUTEX_INITIALIZER;

void func1() {
  x = 0; // RACE!
}

int func2(int a) {
  pthread_mutex_lock(&m5); // TODO NODEADLOCK (thread joined)
  pthread_mutex_lock(&m4); // TODO NODEADLOCK (thread joined)
  if (a)
    x = 3; // NORACE (thread joined)
  else
    x = 4;
  pthread_mutex_unlock(&m4);
  pthread_mutex_unlock(&m5);
  return 0;
}

void *thread() {
  pthread_mutex_lock(&m1); // NODEADLOCK
  pthread_mutex_lock(&m2); // TODO NODEADLOCK (common m1)
  pthread_mutex_lock(&m3); // TODO NODEADLOCK (common m1)
  x = 1; // NORACE (thread joined)
  pthread_mutex_unlock(&m3);
  pthread_mutex_unlock(&m2);
  pthread_mutex_unlock(&m1);

  pthread_mutex_lock(&m4); // TODO NODEADLOCK (thread joined)
  pthread_mutex_lock(&m5); // TODO NODEADLOCK (thread joined)
  x = 2; // RACE!
  pthread_mutex_unlock(&m5);
  pthread_mutex_unlock(&m4);

  return NULL;
}

int main() {
  pthread_t tid;

  pthread_create(&tid, NULL, thread, NULL);

  pthread_mutex_lock(&m1); // NODEADLOCK
  pthread_mutex_lock(&m3); // TODO NODEADLOCK (common m1)
  pthread_mutex_lock(&m2); // TODO NODEADLOCK (common m1)
  func1();
  pthread_mutex_unlock(&m2);
  pthread_mutex_unlock(&m3);
  pthread_mutex_unlock(&m1);

  pthread_join(tid, NULL);

  int r;
  r = func2(5);

  return 0;
}

Add deadlock non-concurrency example from Kroenig et al ASE16


/*************************************************
* IF Operations Header File                      *
* (C) 1999-2008 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_IF_OP_H__
#define BOTAN_IF_OP_H__

#include <botan/bigint.h>
#include <botan/pow_mod.h>
#include <botan/reducer.h>

namespace Botan {

/*************************************************
* IF Operation                                   *
*************************************************/
class BOTAN_DLL IF_Operation
   {
   public:
      virtual BigInt public_op(const BigInt&) const = 0;
      virtual BigInt private_op(const BigInt&) const = 0;
      virtual IF_Operation* clone() const = 0;
      virtual ~IF_Operation() {}
   };

/*************************************************
* Default IF Operation                           *
*************************************************/
class Default_IF_Op : public IF_Operation
   {
   public:
      BigInt public_op(const BigInt& i) const
         { return powermod_e_n(i); }
      BigInt private_op(const BigInt&) const;

      IF_Operation* clone() const { return new Default_IF_Op(*this); }

      Default_IF_Op(const BigInt&, const BigInt&, const BigInt&,
                    const BigInt&, const BigInt&, const BigInt&,
                    const BigInt&, const BigInt&);
   private:
      Fixed_Exponent_Power_Mod powermod_e_n, powermod_d1_p, powermod_d2_q;
      Modular_Reducer reducer;
      BigInt c, q;
   };

}

#endif

/*************************************************
* IF Operations Header File                      *
* (C) 1999-2008 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_IF_OP_H__
#define BOTAN_IF_OP_H__

#include <botan/bigint.h>
#include <botan/pow_mod.h>
#include <botan/reducer.h>

namespace Botan {

/*************************************************
* IF Operation                                   *
*************************************************/
class BOTAN_DLL IF_Operation
   {
   public:
      virtual BigInt public_op(const BigInt&) const = 0;
      virtual BigInt private_op(const BigInt&) const = 0;
      virtual IF_Operation* clone() const = 0;
      virtual ~IF_Operation() {}
   };

/*************************************************
* Default IF Operation                           *
*************************************************/
class BOTAN_DLL Default_IF_Op : public IF_Operation
   {
   public:
      BigInt public_op(const BigInt& i) const
         { return powermod_e_n(i); }
      BigInt private_op(const BigInt&) const;

      IF_Operation* clone() const { return new Default_IF_Op(*this); }

      Default_IF_Op(const BigInt&, const BigInt&, const BigInt&,
                    const BigInt&, const BigInt&, const BigInt&,
                    const BigInt&, const BigInt&);
   private:
      Fixed_Exponent_Power_Mod powermod_e_n, powermod_d1_p, powermod_d2_q;
      Modular_Reducer reducer;
      BigInt c, q;
   };

}

#endif

Add BOTAN_DLL macro to Default_IF_Op

Add BOTAN_DLL macro to Default_IF_Op


/* -*- mode:linux -*- */
/**
 * \file projection.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2008-10-15
 */

#if !defined(_PROJECTION_H_)
#define _PROJECTION_H_

#include <vector>

#include "../state.h"

using namespace std;

/**
 * An abstract projection function class.
 */
class Projection {
public:
	virtual ~Projection();

	/**
	 * Project a state, returning an integer that represents the
	 * NBlock that the state projects into.
	 */
	virtual unsigned int project(const State *s) = 0;

	/**
	 * Get the number of NBlocks that will be used in this
	 * projection.  NBlocks will be numbered from 0..num_nblocks()
	 */
	virtual unsigned int get_num_nblocks(void) = 0;

	/**
	 * Get the list of successor NBlock numbers.
	 */
	virtual vector<unsigned int>get_successors(const NBlock *b) = 0;

	/**
	 * Get the list of predecessor NBlock numbers.
	 */
	virtual vector<unsigned int>get_predecessors(const NBlock *b) = 0;
};

#endif	/* !_PROJECTION_H_ */

/* -*- mode:linux -*- */
/**
 * \file projection.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2008-10-15
 */

#if !defined(_PROJECTION_H_)
#define _PROJECTION_H_

#include <vector>

#include "../state.h"

using namespace std;

/**
 * An abstract projection function class.
 */
class Projection {
public:
	virtual ~Projection();

	/**
	 * Project a state, returning an integer that represents the
	 * NBlock that the state projects into.
	 */
	virtual unsigned int project(const State *s) = 0;

	/**
	 * Get the number of NBlocks that will be used in this
	 * projection.  NBlocks will be numbered from 0..num_nblocks()
	 */
	virtual unsigned int get_num_nblocks(void) = 0;

	/**
	 * Get the list of successor NBlock numbers.
	 */
	virtual vector<unsigned int>get_successors(unsigned int b) = 0;

	/**
	 * Get the list of predecessor NBlock numbers.
	 */
	virtual vector<unsigned int>get_predecessors(unsigned int b) = 0;
};

#endif	/* !_PROJECTION_H_ */

Remove the last reminints of NBlocks from Projection.


#ifndef __LINUX_SLOB_DEF_H
#define __LINUX_SLOB_DEF_H

void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);

static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
{
	return kmem_cache_alloc_node(cachep, flags, -1);
}

void *__kmalloc_node(size_t size, gfp_t flags, int node);

static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
{
	return __kmalloc_node(size, flags, node);
}

/**
 * kmalloc - allocate memory
 * @size: how many bytes of memory are required.
 * @flags: the type of memory to allocate (see kcalloc).
 *
 * kmalloc is the normal method of allocating memory
 * in the kernel.
 */
static inline void *kmalloc(size_t size, gfp_t flags)
{
	return __kmalloc_node(size, flags, -1);
}

static inline void *__kmalloc(size_t size, gfp_t flags)
{
	return kmalloc(size, flags);
}

/**
 * kzalloc - allocate memory. The memory is set to zero.
 * @size: how many bytes of memory are required.
 * @flags: the type of memory to allocate (see kcalloc).
 */
static inline void *kzalloc(size_t size, gfp_t flags)
{
	return __kzalloc(size, flags);
}

#endif /* __LINUX_SLOB_DEF_H */

#ifndef __LINUX_SLOB_DEF_H
#define __LINUX_SLOB_DEF_H

void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);

static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
{
	return kmem_cache_alloc_node(cachep, flags, -1);
}

void *__kmalloc_node(size_t size, gfp_t flags, int node);

static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
{
	return __kmalloc_node(size, flags, node);
}

/**
 * kmalloc - allocate memory
 * @size: how many bytes of memory are required.
 * @flags: the type of memory to allocate (see kcalloc).
 *
 * kmalloc is the normal method of allocating memory
 * in the kernel.
 */
static inline void *kmalloc(size_t size, gfp_t flags)
{
	return __kmalloc_node(size, flags, -1);
}

static inline void *__kmalloc(size_t size, gfp_t flags)
{
	return kmalloc(size, flags);
}

#endif /* __LINUX_SLOB_DEF_H */

slob: Kill off duplicate kzalloc() definition.

With the slab zeroing allocations cleanups Christoph stubbed in a generic
kzalloc(), which was missed on SLOB. Follow the SLAB/SLUB changes and
kill off the __kzalloc() wrapper that SLOB was using.

Reported-by: Jan Engelhardt <f383ed465f890d2e8ea864dd0c28cf8ec50a8942@computergmbh.de>
Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


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

struct s {
  int data;
  int data_array[10];
};

typedef struct {
  int data;
} STYPE;

void g1(struct s* p);

void f(void) {
  int a[10];
  int (*p)[10];
  p = &a;
  (*p)[3] = 1;

  struct s d;
  struct s *q;
  q = &d;
  q->data = 3;
  d.data_array[9] = 17;
}

void f2() {
  char *p = "/usr/local";
  char (*q)[4];
  q = &"abc";
}

void f3() {
  STYPE s;
}

void f4() {
  int a[] = { 1, 2, 3};
  int b[3] = { 1, 2 };
}

void f5() {
  struct s data;
  g1(&data);
}

void f6() {
  char *p;
  p = __builtin_alloca(10);
  p[1] = 'a';
}

Add a test case for alloca().

Add a test case for alloca().

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


#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifndef ELM_LIB_QUICKLAUNCH
void
test_carousel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
   Evas_Object *win, *bg;

   win = elm_win_add(NULL, "carousel", ELM_WIN_BASIC);
   elm_win_title_set(win, "Carousel");
   elm_win_autodel_set(win, 1);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   evas_object_resize(win, 320, 240);
   evas_object_show(win);
}
#endif

#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifndef ELM_LIB_QUICKLAUNCH
void
test_carousel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
   Evas_Object *win, *bg, *car;

   win = elm_win_add(NULL, "carousel", ELM_WIN_BASIC);
   elm_win_title_set(win, "Carousel");
   elm_win_autodel_set(win, 1);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   car = elm_carousel_add(win);
   elm_win_resize_object_add(win, car);
   evas_object_size_hint_weight_set(car, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_carousel_item_add(car, NULL, "Item 1", NULL, NULL);
   elm_carousel_item_add(car, NULL, "Item 2", NULL, NULL);
   elm_carousel_item_add(car, NULL, "Tinga", NULL, NULL);
   elm_carousel_item_add(car, NULL, "Item 4", NULL, NULL);
   evas_object_show(car);

   evas_object_resize(win, 320, 240);
   evas_object_show(win);
}
#endif

Add carousel to carousel test =P

Add carousel to carousel test =P

But it's not working anyway.

SVN revision: 53684


// RUN: %clang_pgogen  -O2 -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata show -function main -counts  %t.profraw| FileCheck  %s

void exit(int);
int g;
__attribute__((noinline)) void foo()
{
  g++;
  if (g==1000)
    exit(0);
}

int main()
{
  while (1) {
    foo();
  }

}

// CHECK: Counters:
// CHECK-NEXT:  main:
// CHECK-NEXT:    Hash: {{.*}}
// CHECK-NEXT:    Counters: 1
// CHECK-NEXT:    Block counts: [1000]

// RUN: %clang_pgogen  -O2 -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata show -function main -counts  %t.profraw| FileCheck  %s

void exit(int);
int g;
__attribute__((noinline)) void foo()
{
  g++;
  if (g==1000)
    exit(0);
}

int main()
{
  while (1) {
    foo();
  }

}

// CHECK: Counters:
// CHECK-NEXT:  main:
// CHECK-NEXT:    Hash: {{.*}}
// CHECK-NEXT:    Counters: 2
// CHECK-NEXT:    Block counts: [1000, 1]

Test case update for D40873

Test case update for D40873

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@320105 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef end_to_end_tests_remote_h_incl
#define end_to_end_tests_remote_h_incl

#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "end_to_end_tests_base.h"

class EndToEndTestsRemote : public EndToEndTestsBase {
    static bool is_receiver;

    CPPUNIT_TEST_SUITE(EndToEndTestsRemote);
    CPPUNIT_TEST(testRandomBytesReceivedCorrectly);
    CPPUNIT_TEST(testDefaultIROBOrdering);
    CPPUNIT_TEST_SUITE_END();

  protected:
    virtual void chooseRole();
    virtual bool isReceiver();

    void testDefaultIROBOrdering();
    void testThunks();
};

#endif

#ifndef end_to_end_tests_remote_h_incl
#define end_to_end_tests_remote_h_incl

#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "end_to_end_tests_base.h"

class EndToEndTestsRemote : public EndToEndTestsBase {
    static bool is_receiver;

    CPPUNIT_TEST_SUITE(EndToEndTestsRemote);
    CPPUNIT_TEST(testRandomBytesReceivedCorrectly);
    CPPUNIT_TEST(testDefaultIROBOrdering);
    CPPUNIT_TEST(testThunks);
    CPPUNIT_TEST_SUITE_END();

  protected:
    virtual void chooseRole();
    virtual bool isReceiver();

    void testDefaultIROBOrdering();
    void testThunks();
};

#endif

Add the thunk test to the suite.

Add the thunk test to the suite.

git-svn-id: 30f60abd488961f3df74c65f80d9d7b5813a1a78@653 1971e5c1-a347-0410-b49b-82492f0cf60c


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

#include <unistd.h>

#include "native_client/src/untrusted/nacl/nacl_irt.h"
#include "native_client/src/untrusted/nacl/nacl_thread.h"
#include "native_client/src/untrusted/nacl/tls.h"

/*
 * This initialization happens early in startup with or without libpthread.
 * It must make it safe for vanilla newlib code to run.
 */
void __pthread_initialize_minimal(size_t tdb_size) {
  /* Adapt size for sbrk. */
  /* TODO(robertm): this is somewhat arbitrary - re-examine). */
  size_t combined_size = (__nacl_tls_combined_size(tdb_size) + 15) & ~15;

  /*
   * Use sbrk not malloc here since the library is not initialized yet.
   */
  void *combined_area = sbrk(combined_size);

  /*
   * Fill in that memory with its initializer data.
   */
  void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size);

  /*
   * Set %gs, r9, or equivalent platform-specific mechanism.  Requires
   * a syscall since certain bitfields of these registers are trusted.
   */
  nacl_tls_init(tp);

  /*
   * Initialize newlib's thread-specific pointer.
   */
  __newlib_thread_init();
}

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

#include <unistd.h>

#include "native_client/src/untrusted/nacl/nacl_irt.h"
#include "native_client/src/untrusted/nacl/nacl_thread.h"
#include "native_client/src/untrusted/nacl/tls.h"

/*
 * This initialization happens early in startup with or without libpthread.
 * It must make it safe for vanilla newlib code to run.
 */
void __pthread_initialize_minimal(size_t tdb_size) {
  size_t combined_size = __nacl_tls_combined_size(tdb_size);

  /*
   * Use sbrk not malloc here since the library is not initialized yet.
   */
  void *combined_area = sbrk(combined_size);

  /*
   * Fill in that memory with its initializer data.
   */
  void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size);

  /*
   * Set %gs, r9, or equivalent platform-specific mechanism.  Requires
   * a syscall since certain bitfields of these registers are trusted.
   */
  nacl_tls_init(tp);

  /*
   * Initialize newlib's thread-specific pointer.
   */
  __newlib_thread_init();
}

Cleanup: Remove unnecessary rounding when allocating initial thread block

The other calls to __nacl_tls_combined_size() don't do this.

__nacl_tls_combined_size() should be doing any necessary rounding itself.

BUG=none
TEST=trybots

Review URL: https://codereview.chromium.org/18555008

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@11698 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


/* toc_private.h - Private optical disc table of contents (TOC) API
 *
 * Copyright (c) 2011 Ian Jacobi <pipian@pipian.com>
 *
 * 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.
 */

#ifndef _LIBCUEIFY_TOC_PRIVATE_H
#define _LIBCUEIFY_TOC_PRIVATE_H

#include <libcueify/types.h>

#define MAX_TRACKS  100  /** Maximum number of tracks on a CD. */

/** Internal structure to hold track data in a TOC. */
typedef struct {
    /** Sub-Q-channel content format. */
    uint8_t adr;
    /** Track control flags. */
    uint8_t control;
    /** Offset of the start of the track (LBA). */
    uint32_t lba;
} cueify_toc_track_private;

/** Internal structure to hold TOC data. */
typedef struct {
    /** Number of the first track in the TOC. */
    uint8_t first_track_number;
    /** Number of the last track in the TOC. */
    uint8_t last_track_number;
    /** Tracks in the TOC. */
    cueify_toc_track_private tracks[MAX_TRACKS];
} cueify_toc_private;

#endif  /* _LIBCUEIFY_TOC_PRIVATE_H */

Add private TOC data type

Add private TOC data type


// For conditions of distribution and use, see copyright notice in license.txt

#ifndef incl_KristalliProtocolModuleApi_h
#define incl_KristalliProtocolModuleApi_h

#if defined (_WINDOWS)
#if defined(KRISTALLIPROTOCOL_MODULE_EXPORTS)
#define KRISTALLIPROTOCOL_MODULE_API __declspec(dllexport)
#else
#define KRISTALLIPROTOCOL_MODULE_API __declspec(dllimport)
#endif
#else
#define KRISTALLIPROTOCOL
#endif

#endif

// For conditions of distribution and use, see copyright notice in license.txt

#ifndef incl_KristalliProtocolModuleApi_h
#define incl_KristalliProtocolModuleApi_h

#if defined (_WINDOWS)
#if defined(KRISTALLIPROTOCOL_MODULE_EXPORTS)
#define KRISTALLIPROTOCOL_MODULE_API __declspec(dllexport)
#else
#define KRISTALLIPROTOCOL_MODULE_API __declspec(dllimport)
#endif
#else
#define KRISTALLIPROTOCOL_MODULE_API
#endif

#endif

Fix syntax error for linux build.

Fix syntax error for linux build.


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

#ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#define CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#pragma once

#include "base/observer_list.h"
#include "chrome/browser/chromeos/cros/update_library.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace chromeos {

class MockUpdateLibrary : public UpdateLibrary {
 public:
  MockUpdateLibrary() {}
  virtual ~MockUpdateLibrary() {}
  MOCK_METHOD1(AddObserver, void(Observer*));  // NOLINT
  MOCK_METHOD1(RemoveObserver, void(Observer*));  // NOLINT
  MOCK_METHOD0(CheckForUpdate, bool(void));
  MOCK_METHOD0(RebootAfterUpdate, bool(void));
  MOCK_METHOD1(SetReleaseTrack, bool(const std::string&));
  MOCK_METHOD1(GetReleaseTrack, std::string());
  MOCK_CONST_METHOD0(status, const Status&(void));

 private:
  DISALLOW_COPY_AND_ASSIGN(MockUpdateLibrary);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_

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

#ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#define CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
#pragma once

#include "base/observer_list.h"
#include "chrome/browser/chromeos/cros/update_library.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace chromeos {

class MockUpdateLibrary : public UpdateLibrary {
 public:
  MockUpdateLibrary() {}
  virtual ~MockUpdateLibrary() {}
  MOCK_METHOD1(AddObserver, void(Observer*));  // NOLINT
  MOCK_METHOD1(RemoveObserver, void(Observer*));  // NOLINT
  MOCK_METHOD0(CheckForUpdate, bool(void));
  MOCK_METHOD0(RebootAfterUpdate, bool(void));
  MOCK_METHOD1(SetReleaseTrack, bool(const std::string&));
  MOCK_METHOD0(GetReleaseTrack, std::string());
  MOCK_CONST_METHOD0(status, const Status&(void));

 private:
  DISALLOW_COPY_AND_ASSIGN(MockUpdateLibrary);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_

Fix the Chrome OS build.

Fix the Chrome OS build.

TEST=make -j40 BUILDTYPE=Release browser_tests
BUG=chromium-os:6030

Review URL: http://codereview.chromium.org/4129006

git-svn-id: http://src.chromium.org/svn/trunk/src@64027 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 21f711df9e9164d849fc0c637465577383f0b1c0


#ifndef PECTOR_MALLOC_ALLOCATOR_COMPAT_H
#define PECTOR_MALLOC_ALLOCATOR_COMPAT_H

#ifdef __APPLE__
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif

#if defined __GNUC__ || defined _WIN32 || defined __APPLE__ || defined __FreeBSD__

#define PT_SIZE_AWARE_COMPAT

#if defined _WIN32
#define PT_MALLOC_USABLE_SIZE(p) _msize(p)
#elif defined __APPLE__
#define PT_MALLOC_USABLE_SIZE(p) malloc_size(p)
#elif defined __GNUC__ || defined __FreeBSD__
#define PT_MALLOC_USABLE_SIZE(p) malloc_usable_size(p)
#endif

#endif // defined __GNUC__ || defined _WIN32 || defined __APPLE__

#endif

#ifndef PECTOR_MALLOC_ALLOCATOR_COMPAT_H
#define PECTOR_MALLOC_ALLOCATOR_COMPAT_H

#ifdef __APPLE__
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif

#if defined __linux__ || defined __gnu_hurd__ || defined _WIN32 || defined __APPLE__ || defined __FreeBSD__

#define PT_SIZE_AWARE_COMPAT

#if defined _WIN32
#define PT_MALLOC_USABLE_SIZE(p) _msize(p)
#elif defined __APPLE__
#define PT_MALLOC_USABLE_SIZE(p) malloc_size(p)
#elif defined __gnu_hurd__ || __linux__ || defined __FreeBSD__
#define PT_MALLOC_USABLE_SIZE(p) malloc_usable_size(p)
#endif

#endif // defined __GNUC__ || defined _WIN32 || defined __APPLE__

#endif

Change malloc_usable_size for Linux with the __linux__ macro

Suggested by Carter Li.
Also add check for GNU/Hurd.


/*
  This file is part of ethash.

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

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

  You should have received a copy of the GNU General Public License
  along with ethash.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file util.h
 * @author Tim Hughes <tim@twistedfury.com>
 * @date 2015
 */
#pragma once
#include <stdint.h>
#include "compiler.h"

#ifdef __cplusplus
extern "C" {
#endif

//#ifdef _MSC_VER
void debugf(char const* str, ...);
//#else
//#define debugf printf
//#endif

static inline uint32_t min_u32(uint32_t a, uint32_t b)
{
	return a < b ? a : b;
}

static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_)
{
	return x < min_ ? min_ : (x > max_ ? max_ : x);
}

#ifdef __cplusplus
}
#endif

/*
  This file is part of ethash.

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

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

  You should have received a copy of the GNU General Public License
  along with ethash.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file util.h
 * @author Tim Hughes <tim@twistedfury.com>
 * @date 2015
 */
#pragma once
#include <stdint.h>
#include "compiler.h"

#ifdef __cplusplus
extern "C" {
#endif

void debugf(char const* str, ...);

static inline uint32_t min_u32(uint32_t a, uint32_t b)
{
	return a < b ? a : b;
}

static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_)
{
	return x < min_ ? min_ : (x > max_ ? max_ : x);
}

#ifdef __cplusplus
}
#endif

Add comment about stack probing and remove unused ifdefs


int test_performance() {
    asic_t *device = asic_init(TI83p);

    struct timespec start, stop;
    unsigned long long t;
    int i;
    clock_gettime(CLOCK_MONOTONIC_RAW, &start);
    for (i = 0; i < 1000000; i++) {
        i -= cpu_execute(device->cpu, 1);
    }
    clock_gettime(CLOCK_MONOTONIC_RAW, &stop);
    t = (stop.tv_sec*1000000000UL) + stop.tv_nsec;
    t -= (start.tv_sec * 1000000000UL) + start.tv_nsec;
    printf("executed 1,000,000 cycles in %llu microseconds (~%llu MHz)\n", t/1000, 1000000000/t);

    asic_free(device);
    return -1;
}

int test_performance() {
    asic_t *device = asic_init(TI83p);

    clock_t start, stop;
    int i;
    start = clock();
    for (i = 0; i < 1000000; i++) {
        i -= cpu_execute(device->cpu, 1);
    }
    stop = clock();
    double time = (double)(stop - start) / (CLOCKS_PER_SEC / 1000);
    double mHz = 1000.0 / time;
    printf("executed 1,000,000 cycles in %f milliseconds (~%f MHz)\n", time, mHz);

    asic_free(device);
    return -1;
}

Switch to more common timing functions

Switch to more common timing functions


#include <string.h>
#include <math.h>
#include <sys/mman.h>
#include "expreval_internal.h"

static void *create_executable_code_aarch64_linux(const char *machine_code, int size);

void *compile_function_internal(compiler c, token first_token, int *size)
{
    unsigned char code[MAX_CODE_LEN];

    unsigned char tmp[] = {0x1e, 0x60, 0x28, 0x00, 0xd6, 0x5f, 0x03, 0xc0};
    int n = 8;

    memcpy(code, tmp, n);

    return create_executable_code_aarch64_linux(code, n);
}

/*
        Attraverso opportune chiamate al kernel alloca un vettore della dimensione adatta che contenga
        il codice appena compilato, vi copia il codice e lo rende eseguibile (avendo cura di renderlo
        non scrivibile, visto che è bene che la memoria non sia mai scrivibile ed eseguibile nello
        stesso momento.
*/
static void *create_executable_code_aarch64_linux(const char *machine_code, int size)
{
        /* Memoria rw- */
        void *mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
        if(mem == MAP_FAILED)
                return NULL;
        /* Scrivo il codice */
        memcpy(mem, machine_code, size);
        /* Inibisco la scrittura e consento l'esecuzione (r-x) */
        if(mprotect(mem, size, PROT_READ | PROT_EXEC) < 0)
        {
                munmap(mem, size);
                return NULL;
        }

        return mem;
}

Add aarch64 jit compiler stub

Add aarch64 jit compiler stub


//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// User-provided blacklist used to disable/alter instrumentation done in
// sanitizers.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H
#define LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H

#include "clang/Basic/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/SpecialCaseList.h"
#include <memory>

namespace llvm {
class GlobalVariable;
class Function;
class Module;
}

namespace clang {
namespace CodeGen {

class SanitizerBlacklist {
  std::unique_ptr<llvm::SpecialCaseList> SCL;

public:
  SanitizerBlacklist(llvm::SpecialCaseList *SCL) : SCL(SCL) {}
  bool isIn(const llvm::Module &M,
            StringRef Category = StringRef()) const;
  bool isIn(const llvm::Function &F) const;
  bool isIn(const llvm::GlobalVariable &G,
            StringRef Category = StringRef()) const;
  bool isBlacklistedType(StringRef MangledTypeName) const;
};
}  // end namespace CodeGen
}  // end namespace clang

#endif

//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// User-provided blacklist used to disable/alter instrumentation done in
// sanitizers.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H
#define LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H

#include "clang/Basic/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/SpecialCaseList.h"
#include <memory>

namespace llvm {
class GlobalVariable;
class Function;
class Module;
}

namespace clang {
namespace CodeGen {

class SanitizerBlacklist {
  std::unique_ptr<llvm::SpecialCaseList> SCL;

public:
  SanitizerBlacklist(std::unique_ptr<llvm::SpecialCaseList> SCL)
      : SCL(std::move(SCL)) {}
  bool isIn(const llvm::Module &M,
            StringRef Category = StringRef()) const;
  bool isIn(const llvm::Function &F) const;
  bool isIn(const llvm::GlobalVariable &G,
            StringRef Category = StringRef()) const;
  bool isBlacklistedType(StringRef MangledTypeName) const;
};
}  // end namespace CodeGen
}  // end namespace clang

#endif

Fix for LLVM API change to SpecialCaseList::create

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


/*
 * This file is part of gspell, a spell-checking library.
 *
 * Copyright 2016 - Ignacio Casal Quinteiro <icq@gnome.org>
 * Copyright 2016 - Sébastien Wilmet <swilmet@gnome.org>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef GSPELL_INIT_H
#define GSPELL_INIT_H

#include <glib.h>

#ifdef G_OS_WIN32
#include <windef.h>

G_GNUC_INTERNAL
HMODULE _gspell_init_get_dll (void);

#endif /* G_OS_WIN32 */

#endif /* GSPELL_INIT_H */

/* ex:set ts=8 noet: */

/*
 * This file is part of gspell, a spell-checking library.
 *
 * Copyright 2016 - Ignacio Casal Quinteiro <icq@gnome.org>
 * Copyright 2016 - Sébastien Wilmet <swilmet@gnome.org>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef GSPELL_INIT_H
#define GSPELL_INIT_H

#include <glib.h>

#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

G_GNUC_INTERNAL
HMODULE _gspell_init_get_dll (void);

#endif /* G_OS_WIN32 */

#endif /* GSPELL_INIT_H */

/* ex:set ts=8 noet: */

Revert "win32: include windef.h instead of windows.h"

This reverts commit 7a51b17a061cb4e83c5d0e862cb1c4c32c7033e7.

This was actually good, normally. See the discussion at:
https://bugzilla.gnome.org/show_bug.cgi?id=774325

Not tested, I don't test gspell on/for Windows.


#ifndef TRACKEDPOINT_H
#define TRACKEDPOINT_H

#include <opencv2/core/affine.hpp>
#include "TrackingData.h"

namespace sensekit { namespace plugins { namespace hand {

    struct TrackedPoint
    {
    public:
        cv::Point m_position;
        cv::Point3f m_worldPosition;
        cv::Point3f m_steadyWorldPosition;
        cv::Point3f m_worldDeltaPosition;
        int m_trackingId;
        int m_inactiveFrameCount;
        float m_totalContributionArea;
        int m_wrongAreaCount;
        int m_activeFrameCount;
        TrackedPointType m_type;
        TrackingStatus m_status;

        TrackedPoint(cv::Point position, cv::Point3f worldPosition, int trackingId)
        {
            m_type = TrackedPointType::CandidatePoint;
            m_status = TrackingStatus::NotTracking;
            m_position = position;
            m_worldPosition = worldPosition;
            m_steadyWorldPosition = worldPosition;
            m_worldDeltaPosition = cv::Point3f(0, 0, 0);
            m_trackingId = trackingId;
            m_inactiveFrameCount = 0;
            m_activeFrameCount = 0;
            m_totalContributionArea = 0;
            m_wrongAreaCount = 0;
        }
    };
}}}

#endif // TRACKEDPOINT_H

#ifndef TRACKEDPOINT_H
#define TRACKEDPOINT_H

#include <opencv2/core/affine.hpp>
#include "TrackingData.h"

namespace sensekit { namespace plugins { namespace hand {

    struct TrackedPoint
    {
    public:
        cv::Point m_position;
        cv::Point3f m_worldPosition;
        cv::Point3f m_worldDeltaPosition;
        cv::Point3f m_steadyWorldPosition;
        int m_trackingId;
        int m_inactiveFrameCount;
        int m_activeFrameCount;
        TrackedPointType m_type;
        TrackingStatus m_status;

        TrackedPoint(cv::Point position, cv::Point3f worldPosition, int trackingId)
        {
            m_type = TrackedPointType::CandidatePoint;
            m_status = TrackingStatus::NotTracking;
            m_position = position;
            m_worldPosition = worldPosition;
            m_steadyWorldPosition = worldPosition;
            m_worldDeltaPosition = cv::Point3f(0, 0, 0);
            m_trackingId = trackingId;
            m_inactiveFrameCount = 0;
            m_activeFrameCount = 0;
        }
    };
}}}

#endif // TRACKEDPOINT_H

Remove old tracked point fields

Remove old tracked point fields


#include "noyes.h"
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0

SpeechTrimmer * new_speech_trimmer() {
  SpeechTrimmer *self = malloc(sizeof(SpeechTrimmer));
  self->leader = 5;
  self->trailer = 5;
  self->speech_started = FALSE;
  self->bcm = new_bent_cent_marker();
  self->false_count = 0;
  self->true_count = 0;
  self->queue = n_list_new();
  self->eos_reached = FALSE;
  self->scs = 20;
  self->ecs = 50;
}

void free_speech_trimmer(SpeechTrimmer *self) {
  free(self);
}

void speech_trimmer_enqueue(SpeechTrimmer *self, NMatrix1* pcm) {
}

NMatrix1 * speech_trimmer_dequeue(SpeechTrimmer *self) {
  if (self->eos_reached || (self->speech_started &&
                            n_list_size(self->queue) > self->ecs)) {
    NMatrix1 * N = n_list_get(self->queue, 0);
    n_list_remove(self->queue, 0, 1);
    return N;
  }
  return NULL;
}
int speech_trimmer_eos(SpeechTrimmer *self) {
  return self->eos_reached;
}

#include "noyes.h"
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0

SpeechTrimmer * new_speech_trimmer() {
  SpeechTrimmer *self = malloc(sizeof(SpeechTrimmer));
  self->leader = 5;
  self->trailer = 5;
  self->speech_started = FALSE;
  self->bcm = new_bent_cent_marker();
  self->false_count = 0;
  self->true_count = 0;
  self->queue = n_list_new();
  self->eos_reached = FALSE;
  self->scs = 20;
  self->ecs = 50;
  return self;
}

void free_speech_trimmer(SpeechTrimmer *self) {
  free(self);
}

void speech_trimmer_enqueue(SpeechTrimmer *self, NMatrix1* pcm) {
}

NMatrix1 * speech_trimmer_dequeue(SpeechTrimmer *self) {
  if (self->eos_reached || (self->speech_started &&
                            n_list_size(self->queue) > self->ecs)) {
    NMatrix1 * N = n_list_get(self->queue, 0);
    n_list_remove(self->queue, 0, 1);
    return N;
  }
  return NULL;
}
int speech_trimmer_eos(SpeechTrimmer *self) {
  return self->eos_reached;
}

Fix memory error due to missing return statement in speech trimmer constructor.


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

#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_BROWSER_SAVE_PASSWORD_PROGRESS_LOGGER_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_BROWSER_SAVE_PASSWORD_PROGRESS_LOGGER_H_

#include <string>

#include "components/autofill/core/common/save_password_progress_logger.h"

class PasswordManagerClient;

namespace password_manager {

// This is the SavePasswordProgressLogger specialization for the browser code,
// where the PasswordManagerClient can be directly called.
class BrowserSavePasswordProgressLogger
    : public autofill::SavePasswordProgressLogger {
 public:
  explicit BrowserSavePasswordProgressLogger(PasswordManagerClient* client);
  virtual ~BrowserSavePasswordProgressLogger();

 protected:
  // autofill::SavePasswordProgressLogger:
  virtual void SendLog(const std::string& log) OVERRIDE;

 private:
  // The PasswordManagerClient to which logs can be sent for display. The client
  // must outlive this logger.
  PasswordManagerClient* const client_;

  DISALLOW_COPY_AND_ASSIGN(BrowserSavePasswordProgressLogger);
};

}  // namespace password_manager

#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_BROWSER_SAVE_PASSWORD_PROGRESS_LOGGER_H_

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

#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_BROWSER_SAVE_PASSWORD_PROGRESS_LOGGER_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_BROWSER_SAVE_PASSWORD_PROGRESS_LOGGER_H_

#include <string>

#include "components/autofill/core/common/save_password_progress_logger.h"

namespace password_manager {

class PasswordManagerClient;

// This is the SavePasswordProgressLogger specialization for the browser code,
// where the PasswordManagerClient can be directly called.
class BrowserSavePasswordProgressLogger
    : public autofill::SavePasswordProgressLogger {
 public:
  explicit BrowserSavePasswordProgressLogger(PasswordManagerClient* client);
  virtual ~BrowserSavePasswordProgressLogger();

 protected:
  // autofill::SavePasswordProgressLogger:
  virtual void SendLog(const std::string& log) OVERRIDE;

 private:
  // The PasswordManagerClient to which logs can be sent for display. The client
  // must outlive this logger.
  PasswordManagerClient* const client_;

  DISALLOW_COPY_AND_ASSIGN(BrowserSavePasswordProgressLogger);
};

}  // namespace password_manager

#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_BROWSER_SAVE_PASSWORD_PROGRESS_LOGGER_H_

Revert 262696 "Revert 262685 "Fix a forward declaration of Passw..."

> Revert 262685 "Fix a forward declaration of PasswordManagerClient"
>
> Compile still fails:
> http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20GTK%20Builder&number=2681
> ../../chrome/browser/ui/gtk/login_prompt_gtk.cc:70:7:error: 'PasswordManager' has not been declared
>
>
> > Fix a forward declaration of PasswordManagerClient
> >
> > This went wrong with landing https://codereview.chromium.org/225093012 and https://codereview.chromium.org/216183008 too close from each other.
> >
> > BUG=347927,348523
> > R=blundell@chromium.org
> > TBR=blundell@chromium.org
> >
> > Review URL: https://codereview.chromium.org/230883002
>
> TBR=vabr@chromium.org
>
> Review URL: https://codereview.chromium.org/231043002

TBR=dmazzoni@google.com

Review URL: https://codereview.chromium.org/231033004

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


#include <string.h>

#include "ruby.h"
#include "rubyspec.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_RB_PROC_NEW
VALUE concat_func(VALUE args) {
  int i;
  char buffer[500] = {0};
  if (TYPE(args) != T_ARRAY) return Qnil;
  for(i = 0; i < RARRAY_LEN(args); ++i) {
    VALUE v = RARRAY_PTR(args)[i];
    strcat(buffer, StringValuePtr(v));
    strcat(buffer, "_");
  }
  buffer[strlen(buffer) - 1] = 0;
  return rb_str_new2(buffer);

}

VALUE sp_underline_concat_proc(VALUE self) {
  return rb_proc_new(concat_func, Qnil);
}
#endif

void Init_proc_spec() {
  VALUE cls;
  cls = rb_define_class("CApiProcSpecs", rb_cObject);

#ifdef HAVE_RB_PROC_NEW
  rb_define_method(cls, "underline_concat_proc", sp_underline_concat_proc, 0);
#endif
}

#ifdef __cplusplus
}
#endif

#include <string.h>

#include "ruby.h"
#include "rubyspec.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_RB_PROC_NEW
VALUE concat_func(VALUE args) {
  int i;
  char buffer[500] = {0};
  if (TYPE(val) != T_ARRAY) return Qnil;
  for(i = 0; i < RARRAY_LEN(args); ++i) {
    VALUE v = RARRAY_PTR(args)[i];
    strcat(buffer, StringValuePtr(v));
    strcat(buffer, "_");
  }
  buffer[strlen(buffer) - 1] = 0;
  return rb_str_new2(buffer);

}

VALUE sp_underline_concat_proc(VALUE self) {
  return rb_proc_new(concat_func, Qnil);
}
#endif

void Init_proc_spec() {
  VALUE cls;
  cls = rb_define_class("CApiProcSpecs", rb_cObject);

#ifdef HAVE_RB_PROC_NEW
  rb_define_method(cls, "underline_concat_proc", sp_underline_concat_proc, 0);
#endif
}

#ifdef __cplusplus
}
#endif

Revert "Fix typo in the commit a5312c77."

This reverts commit 401825d6045ab8e3bd1514404e7c326a045a92ae.

See the following revert for an explanation.


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

#ifndef UI_VIEWS_WIDGET_DESKTOP_CAPTURE_CLIENT_H_
#define UI_VIEWS_WIDGET_DESKTOP_CAPTURE_CLIENT_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/client/capture_client.h"
#include "ui/views/views_export.h"

namespace views {

class VIEWS_EXPORT DesktopCaptureClient : public aura::client::CaptureClient {
 public:
  DesktopCaptureClient();
  virtual ~DesktopCaptureClient();

 private:
  // Overridden from aura::client::CaptureClient:
  virtual void SetCapture(aura::Window* window) OVERRIDE;
  virtual void ReleaseCapture(aura::Window* window) OVERRIDE;
  virtual aura::Window* GetCaptureWindow() OVERRIDE;

  aura::Window* capture_window_;

  DISALLOW_COPY_AND_ASSIGN(DesktopCaptureClient);
};

}  // namespace views

#endif  // UI_VIEWS_WIDGET_DESKTOP_CAPTURE_CLIENT_H_

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

#ifndef UI_VIEWS_WIDGET_DESKTOP_CAPTURE_CLIENT_H_
#define UI_VIEWS_WIDGET_DESKTOP_CAPTURE_CLIENT_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/client/capture_client.h"

namespace views {

class DesktopCaptureClient : public aura::client::CaptureClient {
 public:
  DesktopCaptureClient();
  virtual ~DesktopCaptureClient();

 private:
  // Overridden from aura::client::CaptureClient:
  virtual void SetCapture(aura::Window* window) OVERRIDE;
  virtual void ReleaseCapture(aura::Window* window) OVERRIDE;
  virtual aura::Window* GetCaptureWindow() OVERRIDE;

  aura::Window* capture_window_;

  DISALLOW_COPY_AND_ASSIGN(DesktopCaptureClient);
};

}  // namespace views

#endif  // UI_VIEWS_WIDGET_DESKTOP_CAPTURE_CLIENT_H_

Revert 155836 - Fix static build.

Revert 155836 - Fix static build.

TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10918157

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


/* libtinynotify
 * (c) 2011 Michał Górny
 * 2-clause BSD-licensed
 */

#include "config.h"
#include "tinynotify-cli.h"
#include "tinynotify.h"

#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>

Notification notification_new_from_cmdline(int argc, char *argv[]) {
	int opterr_backup = opterr;
	int arg;

	const char *icon = NOTIFICATION_DEFAULT_APP_ICON;
	const char *summary;
	const char *body = NOTIFICATION_NO_BODY;

	Notification n;

	opterr = 0; /* be quiet about nonsense args */
	while (((arg = getopt(argc, argv, "i:"))) != -1) {
		switch (arg) {
			case 'i':
				icon = optarg;
				break;
		}
	}
	opterr = opterr_backup;

	if (optind >= argc) {
		/* XXX, better error handling? */
		return NULL;
	}

	summary = argv[optind++];
	if (optind < argc)
		body = argv[optind++];

	n = notification_new(summary, body);
	notification_set_formatting(n, 0);
	if (icon)
		notification_set_app_icon(n, icon);

	return n;
}

/* libtinynotify
 * (c) 2011 Michał Górny
 * 2-clause BSD-licensed
 */

#include "config.h"
#include "tinynotify.h"
#include "tinynotify-cli.h"

#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>

Notification notification_new_from_cmdline(int argc, char *argv[]) {
	int opterr_backup = opterr;
	int arg;

	const char *icon = NOTIFICATION_DEFAULT_APP_ICON;
	const char *summary;
	const char *body = NOTIFICATION_NO_BODY;

	Notification n;

	opterr = 0; /* be quiet about nonsense args */
	while (((arg = getopt(argc, argv, "i:"))) != -1) {
		switch (arg) {
			case 'i':
				icon = optarg;
				break;
		}
	}
	opterr = opterr_backup;

	if (optind >= argc) {
		/* XXX, better error handling? */
		return NULL;
	}

	summary = argv[optind++];
	if (optind < argc)
		body = argv[optind++];

	n = notification_new(summary, body);
	notification_set_formatting(n, 0);
	if (icon)
		notification_set_app_icon(n, icon);

	return n;
}

Switch header order to ensure local gets used before system one.


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

#ifndef QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_
#define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_

#include "quic/platform/api/quic_logging.h"
#include "net/quic/platform/impl/quic_test_impl.h"

using QuicFlagSaver = QuicFlagSaverImpl;

// Defines the base classes to be used in QUIC tests.
using QuicTest = QuicTestImpl;
template <class T>
using QuicTestWithParam = QuicTestWithParamImpl<T>;

// Class which needs to be instantiated in tests which use threads.
using ScopedEnvironmentForThreads = ScopedEnvironmentForThreadsImpl;

#define QUIC_TEST_DISABLED_IN_CHROME(name) \
  QUIC_TEST_DISABLED_IN_CHROME_IMPL(name)

inline std::string QuicGetTestMemoryCachePath() {
  return QuicGetTestMemoryCachePathImpl();
}

#define QUIC_SLOW_TEST(test) QUIC_SLOW_TEST_IMPL(test)

#endif  // QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_

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

#ifndef QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_
#define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_

#include "quic/platform/api/quic_logging.h"
#include "net/quic/platform/impl/quic_test_impl.h"
#include "common/platform/api/quiche_test.h"

using QuicFlagSaver = QuicFlagSaverImpl;

// Defines the base classes to be used in QUIC tests.
using QuicTest = QuicTestImpl;
template <class T>
using QuicTestWithParam = QuicTestWithParamImpl<T>;

// Class which needs to be instantiated in tests which use threads.
using ScopedEnvironmentForThreads = ScopedEnvironmentForThreadsImpl;

#define QUIC_TEST_DISABLED_IN_CHROME(name) \
  QUIC_TEST_DISABLED_IN_CHROME_IMPL(name)

inline std::string QuicGetTestMemoryCachePath() {
  return QuicGetTestMemoryCachePathImpl();
}

#define QUIC_SLOW_TEST(test) QUIC_SLOW_TEST_IMPL(test)

#endif  // QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_

Move EXPECT_EQ macro magic from quic/platform to quiche/platform.

The purpose of this machinary is to override EXPECT_EQ and similar comparison
macros so that -Wsigned-compare actually catches signed-unsigned comparison in
internal builds (where gTest implementation is slightly different so otherwise
the warning would not be effective).  This CL moves it from
quic/platform/api/quic_test.h to quiche/common/platform/quiche_test.h, while
also adding an include of the latter to the former, to make users of either
header benefit from it.

The change to frame_formatter_test.cc is necessary to avoid the following
error:

third_party/http2/tools/frame_formatter_test.cc:75:3: error: non-const lvalue reference to type 'basic_string<...>' cannot bind to a temporary of type 'basic_string<...>'
  EXPECT_EQ("\x01 a", std::move(status_or_parsed).value());
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./third_party/quiche/common/platform/impl/quiche_test_impl.h:73:3: note: expanded from macro 'EXPECT_EQ'
  QUIC_LOGGING_INTERNAL_EXPECT_EXT(EqHelper::Compare, ==, val1, val2)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./third_party/quiche/common/platform/impl/quiche_test_impl.h:68:3: note: expanded from macro 'QUIC_LOGGING_INTERNAL_EXPECT_EXT'
  QUIC_LOGGING_INTERNAL_INNER_COMPARE(_comparison_symbol, _val1, _val2);     \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./net/quic/platform_overrides/quiche_platform_impl/quiche_logging_impl.h:164:30: note: expanded from macro 'QUIC_LOGGING_INTERNAL_INNER_COMPARE'
      const decltype(_val2)& _local_val2 = (_val2);                           \

PiperOrigin-RevId: 390165392


#include "../main.h"

class ConfigReader;
class ModuleInterface; // forward-declare so it can be used in modules and server
#include "../connection.h" // declare other classes that use it
#include "../modules.h"
#include "../config.cpp"
#include "../modinterface.cpp"

#include "../main.h"

class ConfigReader;
class ModuleInterface; // forward-declare so it can be used in modules and server
#include "../connection.h" // declare other classes that use it
#include "../modules.h"
#include "../config.cpp"
#include "../modules.cpp"
#include "../modinterface.cpp"

Add a file to the module include.

Add a file to the module include.


/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
 * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */

#include "ua_util.h"

#include <ctype.h>
#include <stdio.h>
void UA_dump_hex_pkg(UA_Byte* buffer, size_t bufferLen) {
    printf("--------------- HEX Package Start ---------------\n");
    char ascii[17];
    memset(ascii,0,17);
    for (size_t i = 0; i < bufferLen; i++)
    {
        if (i == 0)
            printf("%08zx ", i);
        else if (i%16 == 0)
            printf("|%s|\n%08zx ", ascii, i);
        if (isprint((int)(buffer[i])))
            ascii[i%16] = (char)buffer[i];
        else
            ascii[i%16] = '.';
        printf("%02X ", (unsigned char)buffer[i]);
    }
    size_t fillPos = bufferLen %16;
    ascii[fillPos] = 0;
    for (size_t i=fillPos; i<16; i++) {
        printf("   ");
    }
    printf("|%s|\n%08zx\n", ascii, bufferLen);
    printf("--------------- HEX Package END ---------------\n");
}

/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
 * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */

#include "ua_util.h"

#include <ctype.h>
#include <stdio.h>
void UA_dump_hex_pkg(UA_Byte* buffer, size_t bufferLen) {
    printf("--------------- HEX Package Start ---------------\n");
    char ascii[17];
    memset(ascii,0,17);
    for (size_t i = 0; i < bufferLen; i++)
    {
        if (i == 0)
            printf("%08zx ", i);
        else if (i%16 == 0)
            printf(" |%s|\n%08zx ", ascii, i);
        if (isprint((int)(buffer[i])))
            ascii[i%16] = (char)buffer[i];
        else
            ascii[i%16] = '.';
        if (i%8==0)
            printf(" ");
        printf("%02X ", (unsigned char)buffer[i]);

    }
    size_t fillPos = bufferLen %16;
    ascii[fillPos] = 0;
    for (size_t i=fillPos; i<16; i++) {
        if (i%8==0)
            printf(" ");
        printf("   ");
    }
    printf(" |%s|\n%08zx\n", ascii, bufferLen);
    printf("--------------- HEX Package END ---------------\n");
}

Align format with `hexdump -C`

Align format with `hexdump -C`


//
//  TWTValidationLocalization.h
//  TWTValidation
//
//  Created by Prachi Gauriar on 4/3/2014.
//  Copyright (c) 2014 Two Toasters, LLC. All rights reserved.
//

#define TWTLocalizedString(key) \
    [[NSBundle bundleForClass:[self class]] localizedStringForKey:(key) value:@"" table:@"TWTValidation"]

//
//  TWTValidationLocalization.h
//  TWTValidation
//
//  Created by Prachi Gauriar on 4/3/2014.
//  Copyright (c) 2014 Two Toasters, LLC.
//
//  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.
//

#define TWTLocalizedString(key) \
    [[NSBundle bundleForClass:[self class]] localizedStringForKey:(key) value:@"" table:@"TWTValidation"]

Add license to localization header

Add license to localization header


//
//  BDSKSearchGroupViewController.h
//  Bibdesk
//
//  Created by Christiaan Hofman on 1/2/07.
/*
 This software is Copyright (c) 2007
 Christiaan Hofman. All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 - Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.

 - 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.

 - Neither the name of Christiaan Hofman nor the names of any
 contributors may be used to endorse or promote products derived
 from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
 OWNER 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.
 */

#import <Cocoa/Cocoa.h>

@class BDSKCollapsibleView, BDSKEdgeView, BDSKSearchGroup;

@interface BDSKSearchGroupViewController : NSWindowController {
    IBOutlet BDSKCollapsibleView *view;
    IBOutlet BDSKEdgeView *edgeView;
    IBOutlet NSSearchField *searchField;
    IBOutlet NSButton *searchButton;

    BDSKSearchGroup *group;
}

- (NSView *)view;

- (BDSKSearchGroup *)group;
- (void)setGroup:(BDSKSearchGroup *)newGroup;

- (IBAction)changeSearchTerm:(id)sender;
- (IBAction)nextSearch:(id)sender;

@end

Add new header file. (or: xcode is stupid)


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

#ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

#include "chrome/browser/ui/gtk/browser_window_gtk.h"

class Panel;

class PanelBrowserWindowGtk : public BrowserWindowGtk {
 public:
  PanelBrowserWindowGtk(Browser* browser, Panel* panel);
  virtual ~PanelBrowserWindowGtk() {}

  // BrowserWindowGtk overrides
  virtual void Init() OVERRIDE;

  // BrowserWindow overrides
  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;

 protected:
  // BrowserWindowGtk overrides
  virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
  virtual bool HandleTitleBarLeftMousePress(
      GdkEventButton* event,
      guint32 last_click_time,
      gfx::Point last_click_position) OVERRIDE;
  virtual void SaveWindowPosition() OVERRIDE;
  virtual void SetGeometryHints() OVERRIDE;
  virtual bool UseCustomFrame() OVERRIDE;

 private:
  void SetBoundsImpl();

  scoped_ptr<Panel> panel_;
  DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
};

#endif  // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

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

#ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

#include "chrome/browser/ui/gtk/browser_window_gtk.h"

class Panel;

class PanelBrowserWindowGtk : public BrowserWindowGtk {
 public:
  PanelBrowserWindowGtk(Browser* browser, Panel* panel);
  virtual ~PanelBrowserWindowGtk() {}

  // BrowserWindowGtk overrides
  virtual void Init() OVERRIDE;

  // BrowserWindow overrides
  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;

 protected:
  // BrowserWindowGtk overrides
  virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
  virtual bool HandleTitleBarLeftMousePress(
      GdkEventButton* event,
      guint32 last_click_time,
      gfx::Point last_click_position) OVERRIDE;
  virtual void SaveWindowPosition() OVERRIDE;
  virtual void SetGeometryHints() OVERRIDE;
  virtual bool UseCustomFrame() OVERRIDE;

 private:
  void SetBoundsImpl();

  Panel* panel_;
  DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
};

#endif  // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

Revert 88154 - Use scoped_ptr for Panel in PanelBrowserWindowGTK.
Reason: PanelBrowserWindow dtor is now complex and cannot be inlined.

BUG=None
TEST=Verified WindowOpenPanel test now hits Panel destructor.

Review URL: http://codereview.chromium.org/7120011

TBR=jennb@chromium.org
Review URL: http://codereview.chromium.org/7003035

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


/*
** Hook functions for integration with the Floating Temple distributed
** interpreter
*/

#include <stddef.h>

#define floating_temple_c
#define LUA_CORE

#include "lua.h"

#include "floating_temple.h"
#include "lobject.h"
#include "luaconf.h"

static int ft_defaultnewstringhook (lua_State *L, StkId obj, const char *str,
                                    size_t len) {
  return 0;
}

static int ft_defaultnewtablehook (lua_State *L, StkId obj, int b, int c) {
  return 0;
}

#define FT_DEFINE_HOOK_FUNC(install_func, hook_type, hook_var, \
                            default_hook_func) \
  LUAI_DDEF hook_type hook_var = &default_hook_func; \
\
  LUA_API hook_type install_func (hook_type hook) { \
    hook_type old_hook = hook_var; \
    hook_var = hook; \
    return old_hook; \
  }

FT_DEFINE_HOOK_FUNC(ft_installnewstringhook, ft_NewStringHook, ft_newstringhook,
                    ft_defaultnewstringhook)

FT_DEFINE_HOOK_FUNC(ft_installnewtablehook, ft_NewTableHook, ft_newtablehook,
                    ft_defaultnewtablehook)

#undef FT_DEFINE_HOOK_FUNC

/*
** Hook functions for integration with the Floating Temple distributed
** interpreter
*/

#include <stddef.h>

#define floating_temple_c
#define LUA_CORE

#include "lua.h"

#include "floating_temple.h"
#include "lobject.h"
#include "luaconf.h"

#define FT_DEFINE_HOOK_FUNC(install_func, hook_type, hook_var, hook_params, \
                            default_hook_func) \
  static int default_hook_func hook_params { \
    return 0; \
  } \
\
  LUAI_DDEF hook_type hook_var = &default_hook_func; \
\
  LUA_API hook_type install_func (hook_type hook) { \
    hook_type old_hook = hook_var; \
    hook_var = hook; \
    return old_hook; \
  }

FT_DEFINE_HOOK_FUNC(ft_installnewstringhook, ft_NewStringHook, ft_newstringhook,
                    (lua_State *L, StkId obj, const char *str, size_t len),
                    ft_defaultnewstringhook)

FT_DEFINE_HOOK_FUNC(ft_installnewtablehook, ft_NewTableHook, ft_newtablehook,
                    (lua_State *L, StkId obj, int b, int c),
                    ft_defaultnewtablehook)

#undef FT_DEFINE_HOOK_FUNC

Add the definition of the default hook function to the FT_DEFINE_HOOK_FUNCTION macro.


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

#ifndef CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"

class GURL;

class QuotaDispatcherHost : public BrowserMessageFilter {
 public:
  ~QuotaDispatcherHost();
  bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok);

 private:
  void OnQueryStorageUsageAndQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type);
  void OnRequestStorageQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type,
      int64 requested_size);
};

#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

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

#ifndef CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"

class GURL;

class QuotaDispatcherHost : public BrowserMessageFilter {
 public:
  ~QuotaDispatcherHost();
  virtual bool OnMessageReceived(const IPC::Message& message,
                                 bool* message_was_ok);

 private:
  void OnQueryStorageUsageAndQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type);
  void OnRequestStorageQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type,
      int64 requested_size);
};

#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

Fix clang build that have been broken by 81364.

BUG=none
TEST=green tree
TBR=jam

Review URL: http://codereview.chromium.org/6838008

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@81368 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


/**
 * @file
 *
 * @brief
 *
 * @date 09.11.2013
 * @author Anton Bondarev
 */

union idesc_table_entry {
	unsigned int flags;
	struct idesc *idesc;
};

struct idesc_table {
	union idesc_table_entry idesc_entry[TASKS_RES_QUANTITY];
	struct indexator indexator;
};

int idesc_table_add(struct idesc *idesc, int cloexec) {
	struct task task;
	struct idesc_table *idesc_table;
	int idx;

	task = task_self();
	idesc_table = &task->idesc_table;

	idx = index_alloc(&idesc_table->indexator, INDEX_MIN);

	idesc_table->idesc_entry[idx] = idesc;

	return idx;
}

int idesc_table_del(int idx) {
	struct task task;
	struct idesc_table *idesc_table;

	task = task_self();
	idesc_table = &task->idesc_table;

	idesc_table->idesc_entry[idx] = NULL;

	index_free(&idesc_table->indexator, idx);

	return 0;
}

struct idesc *idesc_table_get(int idx) {
	struct task task;
	struct idesc_table *idesc_table;

	task = task_self();
	idesc_table = &task->idesc_table;

	return idesc_table->idesc_entry[idx];
}

int idesc_table_init(struct idesc_table *idesc_table) {
	return 0;
}

Add some stubs for idec_table

desc: Add some stubs for idec_table


#ifndef INSTRUCTION_VISITOR_H_
#define INSTRUCTION_VISITOR_H_

#include "vm/instruction.h"
#include "vm/instructions.h"

namespace grok {
namespace vm {

class InstructionVisitor {
public:
#define DECLARE_VIRTUAL_METHOD(Instr, Class)    \
    virtual void Visit(Class##Instruction *instr) = 0;
INSTRUCTION_LIST_FOR_EACH(DECLARE_VIRTUAL_METHOD)
#undef DECLARE_VIRTUAL_METHOD
};

}
}

#endif

Add InstructionVisitor class for visitor pattern


#define FLT_DIG 	6
#define FLT_MANT_DIG 	24
#define FLT_MAX_10_EXP 	+38
#define FLT_MAX_EXP 	+128
#define FLT_MIN_10_EXP 	-37
#define FLT_MIN_EXP 	-125
#define FLT_RADIX 	2
#define FLT_MAX 	0x1.fffffep127f
#define FLT_MIN 	0x1.0p-126f
#define FLT_EPSILON 	0x1.0p-23f

#ifdef cl_khr_fp64

#define DBL_DIG 	15
#define DBL_MANT_DIG 	53
#define DBL_MAX_10_EXP 	+308
#define DBL_MAX_EXP 	+1024
#define DBL_MIN_10_EXP 	-307
#define DBL_MIN_EXP 	-1021
#define DBL_MAX 	0x1.fffffffffffffp1023
#define DBL_MIN 	0x1.0p-1022
#define DBL_EPSILON 	0x1.0p-52

#endif

#define FLT_DIG 	6
#define FLT_MANT_DIG 	24
#define FLT_MAX_10_EXP 	+38
#define FLT_MAX_EXP 	+128
#define FLT_MIN_10_EXP 	-37
#define FLT_MIN_EXP 	-125
#define FLT_RADIX 	2
#define FLT_MAX 	0x1.fffffep127f
#define FLT_MIN 	0x1.0p-126f
#define FLT_EPSILON 	0x1.0p-23f

#define M_PI_F 0x1.921fb6p+1

#ifdef cl_khr_fp64

#define DBL_DIG 	15
#define DBL_MANT_DIG 	53
#define DBL_MAX_10_EXP 	+308
#define DBL_MAX_EXP 	+1024
#define DBL_MIN_10_EXP 	-307
#define DBL_MIN_EXP 	-1021
#define DBL_MAX 	0x1.fffffffffffffp1023
#define DBL_MIN 	0x1.0p-1022
#define DBL_EPSILON 	0x1.0p-52

#endif

Add definition for M_PI_F v3

Add definition for M_PI_F v3

v2:
  - Use a hexadecimal constant.

v3:
  - Use a hexadecimal constant in floating-point notation.

git-svn-id: e7f1ab7c2a259259587475a3e7520e757882f167@204666 91177308-0d34-0410-b5e6-96231b3b80d8


// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"

// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"

Make test not fail on hosts where the default omp library is gomp.

This is the case on some linuxes, just force libomp so we get the
desired results.

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