// ** QueryString
//
// This program reads chars from stdin without echo and put to stdout.
//

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>

int main(int argc, char * args[])
{
	struct termios old_tio, new_tio;
	unsigned char c;

	/* get the terminal settings for stdin */
	tcgetattr(STDIN_FILENO, &old_tio);

	/* we want to keep the old setting to restore them a the end */
	new_tio = old_tio;

	/* disable canonical mode (buffered i/o) and local echo */
	new_tio.c_lflag &= (~ICANON & ~ECHO);

	/* set the new settings immediately */
	tcsetattr(STDIN_FILENO, TCSANOW, &new_tio);

	while ((c = getchar()) != '\n')
        {
          putchar(c);
	};

	/* restore the former settings */
	tcsetattr(STDIN_FILENO, TCSANOW, &old_tio);

	return 0;
}

Add qstr - query string utility

Add qstr - query string utility


// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s
// CHECK: boo bork bar // zot

// RUN: clang-cc -E -CC %s | FileCheck -strict-whitespace %s
// CHECK: boo bork /* blah*/ bar // zot

// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
// CHECK: boo bork bar

#define FOO bork // blah
boo FOO bar // zot

// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s &&
// CHECK: boo bork bar // zot

// RUN: clang-cc -E -CC %s | FileCheck -strict-whitespace %s &&
// CHECK: boo bork /* blah*/ bar // zot

// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
// CHECK: boo bork bar

#define FOO bork // blah
boo FOO bar // zot

Fix a broken test in rev. 85199.

Fix a broken test in rev. 85199.

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


#include <netinet/in.h>
#include <stdio.h>
#include <sys/socket.h>

int main(int argc, char** argv)
{

	int listen_fd;

	struct sockaddr_in serv_addr;

	listen_fd = socket(AF_INET, SOCK_STREAM, 0);

	serv_addr.sin_family = AF_INET;
	serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
	serv_addr.sin_port = htons(8080);

	bind(listen_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));

	if (listen(listen_fd, 64)) {
		perror("listen");
	} else {

	}

	return 0;
}

#include <netinet/in.h>
#include <stdio.h>
#include <sys/socket.h>
#include <unistd.h>

#define TRUE 1
#define BUFFER_SIZE 8096

int main(int argc, char** argv)
{

	int listen_fd;
	int connection_fd;

	socklen_t length;

	int err;
	int read_len;

	char buffer[BUFFER_SIZE+1];

	struct sockaddr_in serv_addr;
	struct sockaddr_in client_addr;

	listen_fd = socket(AF_INET, SOCK_STREAM, 0);

	serv_addr.sin_family = AF_INET;
	serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
	serv_addr.sin_port = htons(8080);

	err = bind(listen_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));

	if (err == -1) {
		perror("bind");
	}

	err = listen(listen_fd, 64);

	if (err == -1) {
		perror("listen");
	}

	while (TRUE) {

		connection_fd = accept(listen_fd, (struct sockaddr*)&client_addr, &length);

		read_len = read(connection_fd, buffer, BUFFER_SIZE);
		printf("Read %d bytes: %s\n", read_len,  buffer);

		close(connection_fd);
	}

	return 0;
}

Implement accept of incoming requests

Implement accept of incoming requests


/// \file
/// \brief This header contains functionality needed for serializing and deserealizing to/from a stream
#pragma once

#include "ISerializable.h"
#include "IStorage.h"

#include <iostream>

/// Contains all the functionality provided by the library.
namespace simpson
{

/// Serialize object to ostream
std::ostream& operator<<(std::ostream& outStream, simpson::ISerializable& obj);
/// Deserialize object from istream
std::istream& operator>>(std::istream& inStream, simpson::ISerializable* obj);

} // simpson

/// \file
/// \brief This header contains functionality needed for serializing and deserealizing to/from a stream
#pragma once

#include "IStorage.h"

#include <iostream>

/// Contains all the functionality provided by the library.
namespace simpson
{

class ISerializable;

/// Serialize object to ostream
std::ostream& operator<<(std::ostream& outStream, ISerializable& obj);
/// Deserialize object from istream
std::istream& operator>>(std::istream& inStream, ISerializable* obj);

} // simpson

Change include to forward declaration

Change include to forward declaration


//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//

#import <Foundation/Foundation.h>

#define KW_VERSION 0.5

// Blocks being unavailable cripples the usability of Kiwi, but is supported
// because they are not available on anything less than a device running 3.2.
#if defined(__BLOCKS__)
    #define KW_BLOCKS_ENABLED 1
#endif // #if defined(__BLOCKS__)

// As of iPhone SDK 4 GM, exceptions thrown across an NSInvocation -invoke or
// forwardInvocation: boundary in the simulator will terminate the app instead
// of being caught in @catch blocks from the caller side of the -invoke. Kiwi
// tries to handle this by storing the first exception that it would have
// otherwise thrown in a nasty global that callers can look for and handle.
// (Buggy termination is less desirable than global variables).
//
// Obviously, this can only handles cases where Kiwi itself would have raised
// an exception.
#if TARGET_IPHONE_SIMULATOR
    #define KW_TARGET_HAS_INVOCATION_EXCEPTION_BUG 1
#endif // #if TARGET_IPHONE_SIMULATOR

//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//

#import <Foundation/Foundation.h>

#define KW_VERSION 0.5

// Blocks being unavailable cripples the usability of Kiwi, but is supported
// because they are not available on anything less than a device running 3.2.
#if defined(__BLOCKS__)
    #ifndef KW_BLOCKS_ENABLED
        #define KW_BLOCKS_ENABLED 1
    #endif // #ifndef KW_BLOCKS_ENABLED
#endif // #if defined(__BLOCKS__)

// As of iPhone SDK 4 GM, exceptions thrown across an NSInvocation -invoke or
// forwardInvocation: boundary in the simulator will terminate the app instead
// of being caught in @catch blocks from the caller side of the -invoke. Kiwi
// tries to handle this by storing the first exception that it would have
// otherwise thrown in a nasty global that callers can look for and handle.
// (Buggy termination is less desirable than global variables).
//
// Obviously, this can only handles cases where Kiwi itself would have raised
// an exception.
#if TARGET_IPHONE_SIMULATOR
    #define KW_TARGET_HAS_INVOCATION_EXCEPTION_BUG 1
#endif // #if TARGET_IPHONE_SIMULATOR

Add support for disabling blocks externally via preprocessor macro definitions at the project or target level


// A test for the propagation of the -mmcu option to -cc1 and -cc1as

// RUN: %clang -### -target avr -mmcu=atmega328p -save-temps %s 2>&1 | FileCheck %s
// CHECK: clang{{.*}} "-cc1" {{.*}} "-target-cpu" "atmega328p"
// CHECK: clang{{.*}} "-cc1as" {{.*}} "-target-cpu" "atmega328p"

// A test for the propagation of the -mmcu option to -cc1 and -cc1as

// RUN: %clang -### -target avr -no-canonical-prefixes -mmcu=atmega328p -save-temps %s 2>&1 | FileCheck %s
// CHECK: clang{{.*}} "-cc1" {{.*}} "-target-cpu" "atmega328p"
// CHECK: clang{{.*}} "-cc1as" {{.*}} "-target-cpu" "atmega328p"

[Driver] Add a missing -no-canonical-prefixes to test.

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


//
//  BIObjCHelpers.h
//  BIObjCHelpersExample
//
//  Created by Bogdan Iusco on 1/19/15.
//  Copyright (c) 2015 Bogdan Iusco. All rights reserved.
//

// Starters
#import "BIStarterProtocol.h"
#import "BILifecycle.h"
#import "BIStartersFactory.h"
#import "BIOperationQueue.h"

// Views
#import "BITableView.h"

// Datasources
#import "BIDatasourceTableView.h"
#import "BIDatasourceCollectionView.h"
#import "BIDatasourceFetchedTableView.h"
#import "BIDatasourceFetchedCollectionView.h"
#import "BIDatasourceFeedTableView.h"
#import "BIBatch.h"

// Handlers
#import "BIHandlerBase.h"
#import "BIHandlerTableView.h"

// Categories
#import "NSBundle+BIExtra.h"
#import "NSString+BIExtra.h"
#import "NSDate+BIAttributedString.h"

// Batch
#import "BIBatch.h"
#import "BIBatchRequest.h"
#import "BIBatchResponse.h"

//
//  BIObjCHelpers.h
//  BIObjCHelpersExample
//
//  Created by Bogdan Iusco on 1/19/15.
//  Copyright (c) 2015 Bogdan Iusco. All rights reserved.
//

// Starters
#import "BIStarterProtocol.h"
#import "BILifecycle.h"
#import "BIStartersFactory.h"
#import "BIOperationQueue.h"
#import "BILaunchStartersFactory.h"

// Views
#import "BITableView.h"

// Datasources
#import "BIDatasourceTableView.h"
#import "BIDatasourceCollectionView.h"
#import "BIDatasourceFetchedTableView.h"
#import "BIDatasourceFetchedCollectionView.h"
#import "BIDatasourceFeedTableView.h"
#import "BIBatch.h"

// Handlers
#import "BIHandlerBase.h"
#import "BIHandlerTableView.h"

// Categories
#import "NSBundle+BIExtra.h"
#import "NSString+BIExtra.h"
#import "NSDate+BIAttributedString.h"

// Batch
#import "BIBatch.h"
#import "BIBatchRequest.h"
#import "BIBatchResponse.h"

Add BILaunchStartersFactory to interface file


#include <libutil.h>

#ifndef TAILQ_END
#define TAILQ_END(head)			NULL
#endif

#ifndef SIMPLEQ_HEAD
#define SIMPLEQ_HEAD			STAILQ_HEAD
#define SIMPLEQ_HEAD_INITIALIZER	STAILQ_HEAD_INITIALIZER
#define SIMPLEQ_ENTRY			STAILQ_ENTRY
#define SIMPLEQ_INIT			STAILQ_INIT
#define SIMPLEQ_INSERT_AFTER		STAILQ_INSERT_AFTER
#define SIMPLEQ_INSERT_HEAD		STAILQ_INSERT_HEAD
#define SIMPLEQ_INSERT_TAIL		STAILQ_INSERT_TAIL
#define SIMPLEQ_EMPTY			STAILQ_EMPTY
#define SIMPLEQ_FIRST			STAILQ_FIRST
#define SIMPLEQ_REMOVE_AFTER		STAILQ_REMOVE_AFTER
#define SIMPLEQ_REMOVE_HEAD		STAILQ_REMOVE_HEAD
#define SIMPLEQ_FOREACH			STAILQ_FOREACH
#define SIMPLEQ_END(head)		NULL
#endif

Add SIMPLEQ->STAILQ macros for freebsd.

Add SIMPLEQ->STAILQ macros for freebsd.


//This is a preliminary version of this file for testing and learning purposes
//Author: Jonas Iacobi
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

char* getMessage(char* filename){
  char* msg = NULL;
  int   msgLength, txtLength;
  FILE *fp = fopen( filename, "r");

  if(fp){
    //Find end of text file, find file size, and go back to beginning of file.
    fseek(fp, 0, SEEK_END);
    msgLength = ftell(fp);
    fseek(fp, SEEK_SET, 0);

    //Allocate memory for the string
    msg = ((char*) malloc(sizeof(char) * msgLength+1));

    //Read the entire file pointed to by fp in chunks of 2 byte to the string msg and store the read size in txtLength.
    txtLength = fread(msg, sizeof(char), msgLength, fp);
    msg[msgLength] = '\0';
    fclose(fp);
    //Error check
    if(msgLength != txtLength){
      //The read failed somehow. Abort mission.
      free(msg);
      msg = NULL;
      return "Error: Length of file not equal to length of read. That's probably my fault -Jonas";
      }

    return msg;
    }
  else{
    return "Error: File not found. Please contact the poor students who made this.";
    }
}

int main(){
  char* filename = "C:/Users/iacob/Desktop/msg.txt";
  printf("%s\n", filename);
  char* message = getMessage(filename);
  printf("%s\n", message);
  return 0;
}

Revert "Revert "Created a preliminary getMessage method""

This reverts commit 7d29c8faff9ffba05d14e7597e78dd24da7eaab4.


/*
 * Copyright (c) 2013, Court of the University of Glasgow
 * 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 the University of Glasgow nor the names of its
 *   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 HOLDER 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.
 */

#ifndef _STACK_H_
#define _STACK_H_
/*
 * data stack for use with automaton infrastructure
 */

#include "dataStackEntry.h"

typedef struct stack Stack;

Stack          *stack_create(int size);
void           stack_destroy(Stack *st);
void           reset(Stack *st);
void           push(Stack *st, DataStackEntry d);
DataStackEntry pop(Stack *st);

#endif /* _STACK_H_ */

Add BSD 3-clause open source header

Add BSD 3-clause open source header


/* ISC license. */

#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE

#include <stdlib.h>

int main (void)
{
  arc4random_addrandom("", 1) ;
  return 0 ;
}

/* ISC license. */

#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE

#include <stdlib.h>

int main (void)
{
  unsigned char *blah = "" ;
  arc4random_addrandom(blah, 1) ;
  return 0 ;
}

Fix arc4random_addrandom detection for -Werror=pointer-sign


#include <stdio.h>

#include "bincookie.h"

int main(int argc, char *argv[]) {
    if (argc != 2) {
        printf("Usage: %s [Full path to Cookies.binarycookies file]\n", argv[0]);
        printf("Example: %s Cookies.binarycookies\n", argv[0]);
        return 1;
    }

    binarycookies_t *bc = binarycookies_init(argv[1]);
    unsigned int i, j;
    binarycookies_flag flags;

    // Output in Netscape cookies.txt format
    for (i = 0; i < bc->num_pages; i++) {
        for (j = 0; j < bc->pages[i]->number_of_cookies; j++) {
            flags = bc->pages[i]->cookies[j]->flags;

            // domain, flag, path, secure, expiration, name, value
            printf("%s\t%s\t%s\t%s\t%.f\t%s\t%s\n",
                   bc->pages[i]->cookies[j]->url,
                   bc->pages[i]->cookies[j]->url[0] == '.' ? "TRUE" : "FALSE",
                   bc->pages[i]->cookies[j]->path,
                   flags == secure || flags == secure_http_only ? "TRUE" : "FALSE",
                   bc->pages[i]->cookies[j]->expiration_date,
                   bc->pages[i]->cookies[j]->name,
                   bc->pages[i]->cookies[j]->value);
        }
    }

    binarycookies_free(bc);

    return 0;
}

#include <stdio.h>

#include "bincookie.h"

int main(int argc, char *argv[]) {
    if (argc != 2) {
        printf("Usage: %s [Full path to Cookies.binarycookies file]\n", argv[0]);
        printf("Example: %s Cookies.binarycookies\n", argv[0]);
        return 1;
    }

    binarycookies_t *bc = binarycookies_init(argv[1]);
    unsigned int i, j;

    // Output in Netscape cookies.txt format
    for (i = 0; i < bc->num_pages; i++) {
        for (j = 0; j < bc->pages[i]->number_of_cookies; j++) {
            // domain, flag, path, secure, expiration, name, value
            printf("%s\t%s\t%s\t%s\t%.f\t%s\t%s\n",
                   bc->pages[i]->cookies[j]->url,
                   bc->pages[i]->cookies[j]->url[0] == '.' ? "TRUE" : "FALSE",
                   bc->pages[i]->cookies[j]->path,
                   binarycookies_is_secure(bc->pages[i]->cookies[j]) ? "TRUE" : "FALSE",
                   bc->pages[i]->cookies[j]->expiration_date,
                   bc->pages[i]->cookies[j]->name,
                   bc->pages[i]->cookies[j]->value);
        }
    }

    binarycookies_free(bc);

    return 0;
}

Use macro to check security of cookie

Use macro to check security of cookie


// Copyright (c) 2008 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 NET_PROXY_PROXY_RESOLVER_MAC_H_
#define NET_PROXY_PROXY_RESOLVER_MAC_H_
#pragma once

#include <string>

#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_resolver.h"

namespace net {

// Implementation of ProxyResolver that uses the Mac CFProxySupport to implement
// proxies.
class ProxyResolverMac : public ProxyResolver {
 public:
  ProxyResolverMac() : ProxyResolver(false /*expects_pac_bytes*/) {}

  // ProxyResolver methods:
  virtual int GetProxyForURL(const GURL& url,
                             ProxyInfo* results,
                             CompletionCallback* callback,
                             RequestHandle* request,
                             const BoundNetLog& net_log);

  virtual void CancelRequest(RequestHandle request) {
    NOTREACHED();
  }

  virtual int SetPacScript(
      const scoped_refptr<ProxyResolverScriptData>& script_data,
      CompletionCallback* /*callback*/) {
    script_data_ = script_data_;
    return OK;
  }

 private:
  scoped_refptr<ProxyResolverScriptData> script_data_;
};

}  // namespace net

#endif  // NET_PROXY_PROXY_RESOLVER_MAC_H_

// Copyright (c) 2008 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 NET_PROXY_PROXY_RESOLVER_MAC_H_
#define NET_PROXY_PROXY_RESOLVER_MAC_H_
#pragma once

#include <string>

#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_resolver.h"

namespace net {

// Implementation of ProxyResolver that uses the Mac CFProxySupport to implement
// proxies.
class ProxyResolverMac : public ProxyResolver {
 public:
  ProxyResolverMac() : ProxyResolver(false /*expects_pac_bytes*/) {}

  // ProxyResolver methods:
  virtual int GetProxyForURL(const GURL& url,
                             ProxyInfo* results,
                             CompletionCallback* callback,
                             RequestHandle* request,
                             const BoundNetLog& net_log);

  virtual void CancelRequest(RequestHandle request) {
    NOTREACHED();
  }

  virtual int SetPacScript(
      const scoped_refptr<ProxyResolverScriptData>& script_data,
      CompletionCallback* /*callback*/) {
    script_data_ = script_data;
    return OK;
  }

 private:
  scoped_refptr<ProxyResolverScriptData> script_data_;
};

}  // namespace net

#endif  // NET_PROXY_PROXY_RESOLVER_MAC_H_

Fix a typo, that could cause a crash on mac.

BUG=50717
TBR=rvargas
TEST=Set system proxy settings to use a custom PAC script, then launch TestShell.app -- should not crash.
Review URL: http://codereview.chromium.org/3023030

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


/* ===-- assembly.h - compiler-rt assembler support macros -----------------===
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is distributed under the University of Illinois Open Source
 * License. See LICENSE.TXT for details.
 *
 * ===----------------------------------------------------------------------===
 *
 * This file defines macros for use in compiler-rt assembler source.
 * This file is not part of the interface of this library.
 *
 * ===----------------------------------------------------------------------===
 */

#ifndef COMPILERRT_ASSEMBLY_H
#define COMPILERRT_ASSEMBLY_H

// Define SYMBOL_NAME to add the appropriate symbol prefix; we can't use
// USER_LABEL_PREFIX directly because of cpp brokenness.
#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)

#define SYMBOL_NAME(name) name
#define SEPARATOR @

#else

#define SYMBOL_NAME(name) _##name
#define SEPARATOR ;

#endif

#define DEFINE_COMPILERRT_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR     \
  SYMBOL_NAME(name):

#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR             \
  .private_extern SYMBOL_NAME(name) SEPARATOR    \
  SYMBOL_NAME(name):

#endif /* COMPILERRT_ASSEMBLY_H */

/* ===-- assembly.h - compiler-rt assembler support macros -----------------===
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is distributed under the University of Illinois Open Source
 * License. See LICENSE.TXT for details.
 *
 * ===----------------------------------------------------------------------===
 *
 * This file defines macros for use in compiler-rt assembler source.
 * This file is not part of the interface of this library.
 *
 * ===----------------------------------------------------------------------===
 */

#ifndef COMPILERRT_ASSEMBLY_H
#define COMPILERRT_ASSEMBLY_H

// Define SYMBOL_NAME to add the appropriate symbol prefix; we can't use
// USER_LABEL_PREFIX directly because of cpp brokenness.
#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)

#define SYMBOL_NAME(name) name
#define SEPARATOR @

#else

#define SYMBOL_NAME(name) #__USER_LABEL_PREFIX__ ##name
#define SEPARATOR ;

#endif

#define DEFINE_COMPILERRT_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR     \
  SYMBOL_NAME(name):

#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR             \
  .private_extern SYMBOL_NAME(name) SEPARATOR    \
  SYMBOL_NAME(name):

#endif /* COMPILERRT_ASSEMBLY_H */

Use __USER_LABEL_PREFIX__ so that we don't add a _ prefix on ELF.

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


#ifndef PHEVALUATOR_CARD_H
#define PHEVALUATOR_CARD_H

#ifdef __cplusplus

#include <unordered_map>
#include <string>

namespace phevaluator {

class Card {
 public:
  Card() {}

  Card(int id) : id_(id) {}

  Card(std::string name) {
    const std::unordered_map<char, int> rankMap = {
      {'2', 0}, {'3', 1}, {'4', 2}, {'5', 3},
      {'6', 4}, {'7', 5}, {'8', 6}, {'9', 7},
      {'T', 8}, {'J', 9}, {'Q', 10}, {'K', 11}, {'A', 12},
    };
    const std::unordered_map<char, int> suitMap = {
      {'C', 0}, {'D', 1}, {'H', 2}, {'S', 3},
      {'c', 0}, {'d', 1}, {'h', 2}, {'s', 3},
    };

    if (name.length() < 2) {
      // TODO: throw an exception here
    }

    id_ = rankMap.at(name[0]) * 4 + suitMap.at(name[1]);
  }

  operator int() const { return id_; }

 private:
  int id_;
};

} // namespace phevaluator

#endif // __cplusplus

#endif // PHEVALUATOR_CARD_H

#ifndef PHEVALUATOR_CARD_H
#define PHEVALUATOR_CARD_H

#ifdef __cplusplus

#include <unordered_map>
#include <string>

namespace phevaluator {

class Card {
 public:
  Card() {}

  Card(int id) : id_(id) {}

  Card(std::string name) {
    const std::unordered_map<char, int> rankMap = {
      {'2', 0}, {'3', 1}, {'4', 2}, {'5', 3},
      {'6', 4}, {'7', 5}, {'8', 6}, {'9', 7},
      {'T', 8}, {'J', 9}, {'Q', 10}, {'K', 11}, {'A', 12},
    };
    const std::unordered_map<char, int> suitMap = {
      {'C', 0}, {'D', 1}, {'H', 2}, {'S', 3},
      {'c', 0}, {'d', 1}, {'h', 2}, {'s', 3},
    };

    if (name.length() < 2) {
      // TODO: throw an exception here
    }

    id_ = rankMap.at(name[0]) * 4 + suitMap.at(name[1]);
  }

  Card(const char name[]) : Card(std::string(name)) {}

  operator int() const { return id_; }

 private:
  int id_;
};

} // namespace phevaluator

#endif // __cplusplus

#endif // PHEVALUATOR_CARD_H

Add parameter type `const char []` to the Card constructor


// RUN: %ucc -fsyntax-only %s

typedef int array[3];

const array yo; // int const yo[3];
//                             ^~ no const here

h(array); // int h(int [3]);

i(const array); // int i(int const [3]);
//                                 ^~ no const here

j(int[const]); // int j(int *const);

_Static_assert(_Generic(yo, const int[3]: 1) == 1, "");

_Static_assert(_Generic(&h, int (*)(int[3]): 1) == 1, "");
_Static_assert(_Generic(&h, int (*)(int const[3]): 1, default: 2) == 2, "");
_Static_assert(_Generic(&h, int (*)(int *const): 1) == 1, "");
_Static_assert(_Generic(&h, int (*)(int *): 1) == 1, "");

_Static_assert(_Generic(&i, int (*)(int const[3]): 1) == 1, "");
_Static_assert(_Generic(&i, int (*)(int      [3]): 1, default: 2) == 2, "");
_Static_assert(_Generic(&i, int (*)(int const *): 1) == 1, "");
_Static_assert(_Generic(&i, int (*)(int const *const): 1) == 1, "");

_Static_assert(_Generic(&j, int (*)(int *const): 1) == 1, "");
_Static_assert(_Generic(&j, int (*)(int [const]): 1) == 1, "");
_Static_assert(_Generic(&j, int (*)(int const *const): 1, default: 2) == 2, "");
_Static_assert(_Generic(&j, int (*)(int const [const]): 1, default: 2) == 2, "");

Add function parameter qualifier type tests


#ifndef __BYTESTREAM__
#define __BYTESTREAM__

#include <stdint.h>
#include <unistd.h>

#define BS_RO 0
#define BS_RW 1

typedef struct _ByteStream {
  char* filename;
  size_t size;

  uint8_t* data;
  uint32_t offset;

  int exhausted;
} ByteStream;

ByteStream* bsalloc(unsigned int size);
ByteStream* bsmap(char* filename);
int bsfree(ByteStream* bstream);

void bsseek(ByteStream* bs, uint32_t offset);
void bsreset(ByteStream* bs);

unsigned int bsread(ByteStream* bs, uint8_t* buf, size_t size);
unsigned int bsread_offset(ByteStream* bs, uint8_t* buf, size_t size,
			   uint32_t offset);

int bswrite(ByteStream* bs, uint8_t* data, unsigned int size);
unsigned int bswrite_offset(ByteStream* bs, uint8_t* buf, size_t size,
			    uint32_t offset);

int bssave(ByteStream* bs, char* filename);

#endif

#ifndef __BYTESTREAM__
#define __BYTESTREAM__

#include <stdint.h>
#include <unistd.h>

#define BS_RO 0
#define BS_RW 1

// MAP_ANONYMOUS is MAP_ANON on OSX, so this will let us compile
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif

typedef struct _ByteStream {
  char* filename;
  size_t size;

  uint8_t* data;
  uint32_t offset;

  int exhausted;
} ByteStream;

ByteStream* bsalloc(unsigned int size);
ByteStream* bsmap(char* filename);
int bsfree(ByteStream* bstream);

void bsseek(ByteStream* bs, uint32_t offset);
void bsreset(ByteStream* bs);

unsigned int bsread(ByteStream* bs, uint8_t* buf, size_t size);
unsigned int bsread_offset(ByteStream* bs, uint8_t* buf, size_t size,
			   uint32_t offset);

int bswrite(ByteStream* bs, uint8_t* data, unsigned int size);
unsigned int bswrite_offset(ByteStream* bs, uint8_t* buf, size_t size,
			    uint32_t offset);

int bssave(ByteStream* bs, char* filename);

#endif

Fix compilation on OSX MAP_ANONYMOUS is MAP_ANON on OSX, so this will let the project compile.


#ifndef __LIB_DBG__
#define __LIB_DBG__

#define DEBUG
#ifdef DEBUG
# define printk(fmt, ...)					\
		({						\
			char ____fmt[] = fmt;			\
			trace_printk(____fmt, sizeof(____fmt),	\
				     ##__VA_ARGS__);		\
		})
#else
# define printk(fmt, ...)					\
		do { } while (0)
#endif

#endif /* __LIB_DBG__ */

#ifndef __LIB_DBG__
#define __LIB_DBG__

#ifdef DEBUG
# define printk(fmt, ...)					\
		({						\
			char ____fmt[] = fmt;			\
			trace_printk(____fmt, sizeof(____fmt),	\
				     ##__VA_ARGS__);		\
		})
#else
# define printk(fmt, ...)					\
		do { } while (0)
#endif

#endif /* __LIB_DBG__ */

Remove DEBUG for performance testing.

Remove DEBUG for performance testing.


#ifndef	APIMOCK_RESOURCESTRATEGY_H
#define APIMOCK_RESOURCESTRATEGY_H

#include "requestdata.h"
#include "responsedata.h"

namespace ApiMock {
	class ResourceStrategy {
	public:
		virtual ~ResourceStrategy() {}
		virtual ResponseData CreateResponse(const RequestData& request) = 0;
	};
}

#endif

Add a resource strategy interface

Add a resource strategy interface


#ifndef QT4COMPAT_H
#define QT4COMPAT_H

#include <QtCore/QtGlobal>

#ifndef Q_LIKELY
#	define Q_LIKELY(s) s
#endif

#ifndef Q_UNLIKELY
#	define Q_UNLIKELY(s) s
#endif

#ifndef Q_UNREACHABLE
#	define Q_UNREACHABLE() Q_ASSERT(false)
#endif

#ifndef Q_ASSUME
#	define Q_ASSUME(s) if (s) {} else { Q_UNREACHABLE(); }
#endif

#endif // QT4COMPAT_H

#ifndef QT4COMPAT_H
#define QT4COMPAT_H

#include <QtCore/QtGlobal>

#if !defined(Q_UNREACHABLE) && !defined(Q_ASSUME)
#	if defined(Q_CC_INTEL) || defined(Q_CC_MSVC)
#		define Q_UNREACHABLE() __assume(0)
#		define Q_ASSUME(s) __assume(s)
#	elif defined(Q_CC_CLANG)
#		define Q_UNREACHABLE() __builtin_unreachable()
#	elif defined(Q_CC_GNU) && defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
#		define Q_UNREACHABLE() __builtin_unreachable()
#	endif
#endif

#if !defined(Q_LIKELY) && !defined(Q_UNLIKELY)
#	ifdef __GNUC__
#		define Q_LIKELY(expr)    __builtin_expect(!!(expr), true)
#		define Q_UNLIKELY(expr)  __builtin_expect(!!(expr), false)
#	endif
#endif

#ifndef Q_LIKELY
#	define Q_LIKELY(s) s
#endif

#ifndef Q_UNLIKELY
#	define Q_UNLIKELY(s) s
#endif

#ifndef Q_UNREACHABLE
#	define Q_UNREACHABLE() Q_ASSERT(false)
#endif

#ifndef Q_ASSUME
#	define Q_ASSUME(s) if (s) {} else { Q_UNREACHABLE(); }
#endif

#endif // QT4COMPAT_H

Use compiler detection for Q_LIKELY, Q_UNLIKELY, Q_ASSUME, Q_UNREACHABLE [ci skip]


#ifndef ICAL_STREAMPOS_H
#define ICAL_STREAMPOS_H

namespace ical {

/**
 * Represents a postion in the (source) stream. It is used for constructing
 * nice error messages.
 *
 * Note: only CRLF ("\r\n") is considered as a line ending in order to match
 * the definition of 'content line' from RFC 5545.
 */
class StreamPos
{
private:
    unsigned long column = 0;
    unsigned long line = 0;

public:
    unsigned long getLine() const { return line; }
    unsigned long getColumn() const { return column; }

    StreamPos() { }

    void advanceColumn()
    {
        ++column;
    }

    void advanceLine()
    {
        column = 0;
        ++line;
    }
};

} // namespace ical

#endif // ICAL_STREAMPOS_H

#ifndef ICAL_STREAMPOS_H
#define ICAL_STREAMPOS_H

namespace ical {

/**
 * Represents a postion in the (source) stream. It is used for constructing
 * nice error messages.
 *
 * Note: only CRLF ("\r\n") is considered as a line ending in order to match
 * the definition of 'content line' from RFC 5545.
 */
class StreamPos
{
private:
    unsigned long column = 0;
    unsigned long line = 0;

public:
    unsigned long getLine() const { return line + 1; }
    unsigned long getColumn() const { return column + 1; }

    StreamPos() { }

    void advanceColumn()
    {
        ++column;
    }

    void advanceLine()
    {
        column = 0;
        ++line;
    }
};

} // namespace ical

#endif // ICAL_STREAMPOS_H

Return one-based line/column numbers from StreamPos.

(Because obviously people expect "Line 1" to mean the first line...)


#ifndef ICMPV4_H
#define ICMPV4_H

#include "syshead.h"
#include "netdev.h"

#define ICMP_V4_REPLY           0x00
#define ICMP_V4_DST_UNREACHABLE 0x03
#define ICMP_V4_SRC_QUENCH      0x04
#define ICMP_V4_REDIRECT        0x05
#define ICMP_V4_ECHO            0x08
#define ICMP_V4_ROUTER_ADV      0x09
#define ICMP_V4_ROUTER_SOL      0x0a
#define ICMP_V4_TIMEOUT         0x0b
#define ICMP_V4_MALFORMED       0x0c

struct icmp_v4 {
    uint8_t type;
    uint8_t code;
    uint16_t csum;
    uint8_t data[];
} __attribute__((packed));

struct icmp_v4_echo {
    uint16_t id;
    uint16_t seq;
    uint8_t data[];
} __attribute__((packed));

void icmpv4_incoming(struct netdev *netdev, struct eth_hdr *hdr);
void icmpv4_reply(struct netdev *netdev, struct eth_hdr *hdr);

#endif

#ifndef ICMPV4_H
#define ICMPV4_H

#include "syshead.h"
#include "netdev.h"

#define ICMP_V4_REPLY           0x00
#define ICMP_V4_DST_UNREACHABLE 0x03
#define ICMP_V4_SRC_QUENCH      0x04
#define ICMP_V4_REDIRECT        0x05
#define ICMP_V4_ECHO            0x08
#define ICMP_V4_ROUTER_ADV      0x09
#define ICMP_V4_ROUTER_SOL      0x0a
#define ICMP_V4_TIMEOUT         0x0b
#define ICMP_V4_MALFORMED       0x0c

struct icmp_v4 {
    uint8_t type;
    uint8_t code;
    uint16_t csum;
    uint8_t data[];
} __attribute__((packed));

struct icmp_v4_echo {
    uint16_t id;
    uint16_t seq;
    uint8_t data[];
} __attribute__((packed));

struct icmp_v4_dst_unreachable {
    uint8_t unused;
    uint8_t len;
    uint16_t var;
    uint8_t data[];
} __attribute__((packed));

void icmpv4_incoming(struct netdev *netdev, struct eth_hdr *hdr);
void icmpv4_reply(struct netdev *netdev, struct eth_hdr *hdr);

#endif

Add ICMPv4 dst unreachable -message definition

Yeah, this might end up being unimplemented :-(


#ifndef SPECIFIC_INLINE_ASM_GCTXT
#define SPECIFIC_INLINE_ASM_GCTXT

#endif

#ifndef SPECIFIC_INLINE_ASM_GCTXT
#define SPECIFIC_INLINE_ASM_GCTXT

#define INLINE_ASM_GCTXT(uc)  getcontext(&uc)

#endif

Define the INLINE_ASM_GCTXT() macro for aarch64. This was breaking the MEMLEAK source on arm.


// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3.*4'
#include <stddef.h>

// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3'
#include <stddef.h>

Change this test to reflect the state we are moving in. The Clang
builtin headers are no longer going to receive the old 'implicit extern
"C" block' semantics. This hint is actually ignored by both Clang and
GCC at this point, and Clang's own builtin headers can simply be changed
if there is any issue with this. Clang should be free to include these
however it wants, and so shorter and simpler is better.

Note: *nothing* is changing about the *system* stddef.h include. That
should always have the exact same include semantics, whether with Clang
or GCC or any other compiler. Only the compiler-builtin header search
path is changing.

If anyone knows of some risk that this introduces that I've not thought
of, please chime in. So far, only Windows has switched to the Brave New
World, but others should be switching soon.

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


#ifdef __aarch64__
# define STATIC_CHAIN_REG  "x18"
#elif defined(__alpha__)
# define STATIC_CHAIN_REG  "r1"
#elif defined(__arm__)
# define STATIC_CHAIN_REG  "ip"
#elif defined(__sparc__)
# if defined(__arch64__) || defined(__sparcv9)
#  define STATIC_CHAIN_REG "g5"
# else
#  define STATIC_CHAIN_REG "g2"
# endif
#elif defined(__x86_64__)
# define STATIC_CHAIN_REG  "r10"
#elif defined(__i386__)
# ifndef ABI_NUM
#  define STATIC_CHAIN_REG  "ecx"	/* FFI_DEFAULT_ABI only */
# endif
#endif

#ifdef __aarch64__
# define STATIC_CHAIN_REG  "x18"
#elif defined(__alpha__)
# define STATIC_CHAIN_REG  "$1"
#elif defined(__arm__)
# define STATIC_CHAIN_REG  "ip"
#elif defined(__sparc__)
# if defined(__arch64__) || defined(__sparcv9)
#  define STATIC_CHAIN_REG "g5"
# else
#  define STATIC_CHAIN_REG "g2"
# endif
#elif defined(__x86_64__)
# define STATIC_CHAIN_REG  "r10"
#elif defined(__i386__)
# ifndef ABI_NUM
#  define STATIC_CHAIN_REG  "ecx"	/* FFI_DEFAULT_ABI only */
# endif
#endif

Fix alpha static chain register name

testsuite: Fix alpha static chain register name


// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#pragma once

// Internal build flag for namespace discrimination
#define AUTOWIRING_IS_BEING_BUILT

// Only include these headers in cases where a pch can be generated
// Currently this is only supported on MSVC
#ifdef _MSC_VER
  #include <thread>
  #ifndef NOMINMAX
    #define NOMINMAX
  #endif
#endif

#ifndef _MSC_VER
  #include <stdlib.h>
#endif

// Preconfiguration:
#include "AutowiringConfig.h"

// C++11 glue logic, for platforms that have incomplete C++11 support
#include "C++11/cpp11.h"

// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#pragma once

// Internal build flag for namespace discrimination
#define AUTOWIRING_IS_BEING_BUILT

// Only include these headers in cases where a pch can be generated
// Currently this is only supported on MSVC
#ifdef _MSC_VER
  #ifndef NOMINMAX
    #define NOMINMAX
  #endif

  #include <algorithm>
  #include <functional>
  #include <future>
  #include <iosfwd>
  #include <list>
  #include <map>
  #include <memory>
  #include <mutex>
  #include <queue>
  #include <set>
  #include <sstream>
  #include <string>
  #include <thread>
  #include <tuple>
  #include <type_traits>
  #include <typeindex>
  #include <unordered_map>
  #include <unordered_set>
  #include <vector>
#endif

#ifndef _MSC_VER
  #include <stdlib.h>
#endif

// Preconfiguration:
#include "AutowiringConfig.h"

// C++11 glue logic, for platforms that have incomplete C++11 support
#include "C++11/cpp11.h"

Make better use of precompiled header

Make better use of precompiled header

These headers are used pretty much everywhere in autowiring.  New compile time is 50% of what it was on MSVC.

Before: 33.87s
After: 17.77s


//
//  ObjectiveChain.h
//  Objective-Chain
//
//  Created by Martin Kiss on 30.12.13.
//
//

#import "OCAConnection.h"
#import "OCAProducer.h"

Add first classes to umbrella header

Add first classes to umbrella header


/* metatag.c: Program for adding metadata to a file
 * By: Forrest Kerslager, Nick Noto, David Taylor, Kevin Yeap,
 *     Connie Yu
 *
 * 2014/06/06
 * */

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

int main(int argc, char** argv){
    char* buffer;
    int fd, i, len;

    if(argc < 3){
        fprintf(stderr, "Usage: metatag FILE TAG\n");
        exit(1);
    }
    fd=open(argv[1], O_RDWR);
    if(fd == -1){
        fprintf(stderr, "Error, file not found\n");
        exit(1);
    }
    buffer = "";
    for(i=2; i<argc; i++){
        strcat(buffer, argv[i]);
        strcat(buffer, " ");
    }
    len = strlen(buffer);
    metawrite(fd,&buffer,len);
    close(fd);
    return 0;

}

/* metatag.c: Program for adding metadata to a file
 * By: Forrest Kerslager, Nick Noto, David Taylor, Kevin Yeap,
 *     Connie Yu
 *
 * 2014/06/06
 * */

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

#define MAX_LEN 1024

int main(int argc, char** argv){
    char* buffer;
    int fd, i, len;

    if(argc < 3){
        fprintf(stderr, "Usage: metatag FILE TAG\n");
        exit(1);
    }
    fd=open(argv[1], O_RDWR);
    if(fd == -1){
        fprintf(stderr, "Error, file not found\n");
        exit(1);
    }
    buffer = "";
    for(i=2; i<argc; i++){
        strcat(buffer, argv[i]);
        strcat(buffer, " ");
    }
    len = strlen(buffer);
    if(len > MAX_LEN-1){
        fprintf(stderr, "Input stream exceeds max length\n");
        exit(1);
    }
    metawrite(fd,&buffer,len);
    close(fd);
    return 0;

}

Add max length error check

Add max length error check


// Offset of each register in the register map,
// as it's saved by asm_entry_amd64.s

#pragma once

#define RAX 0x00
#define RBX 0x08
#define RCX 0x10
#define RDX 0x18
#define RSI 0x20
#define RDI 0x28
#define R8  0x30
#define R9  0x38
#define R10 0x40
#define R11 0x48
#define R12 0x50
#define R13 0x58
#define R14 0x60
#define R15 0x68

#define XMM0 0x70
#define XMM1 0x80
#define XMM2 0x90
#define XMM3 0xA0
#define XMM4 0xB0
#define XMM5 0xC0
#define XMM6 0xE0
#define XMM7 0xF0

// Offset of each register in the register map,
// as it's saved by asm_entry_amd64.s

#pragma once

#define RAX 0x00
#define RBX 0x08
#define RCX 0x10
#define RDX 0x18
#define RSI 0x20
#define RDI 0x28
#define R8  0x30
#define R9  0x38
#define R10 0x40
#define R11 0x48
#define R12 0x50
#define R13 0x58
#define R14 0x60
#define R15 0x68

#define XMM0 0x70
#define XMM1 0x80
#define XMM2 0x90
#define XMM3 0xA0
#define XMM4 0xB0
#define XMM5 0xC0
#define XMM6 0xD0
#define XMM7 0xE0

Fix one more register addressing bug

Fix one more register addressing bug


// @(#)root/base:$Name:  $:$Id: TVersionCheck.h,v 1.2 2007/05/10 16:04:32 rdm Exp $
// Author: Fons Rademakers   9/5/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVersionCheck                                                        //
//                                                                      //
// Used to check if the shared library or plugin is compatible with     //
// the current version of ROOT.                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_RVersion
#include "RVersion.h"
#endif

class TVersionCheck {
public:
   TVersionCheck(int versionCode);  // implemented in TSystem.cxx
};

static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);

#endif

// @(#)root/base:$Name:  $:$Id: TVersionCheck.h,v 1.3 2007/05/10 18:16:58 rdm Exp $
// Author: Fons Rademakers   9/5/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVersionCheck                                                        //
//                                                                      //
// Used to check if the shared library or plugin is compatible with     //
// the current version of ROOT.                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_RVersion
#include "RVersion.h"
#endif

class TVersionCheck {
public:
   TVersionCheck(int versionCode);  // implemented in TSystem.cxx
};

#ifndef __CINT__
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
#endif

#endif

Hide a static function to CINT. With this fix g4root compiles OK.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@18737 27541ba8-7e3a-0410-8455-c3a389f83636


#ifndef ERROR_H
#define ERROR_H

/*
 * Note that we include "fmt" in the variadic argument list, because C99
 * apparently doesn't allow variadic macros to be invoked without any vargs
 * parameters.
 */
#define ERROR(...)      var_error(__FILE__, __LINE__, __VA_ARGS__)
#define FAIL()          simple_error(__FILE__, __LINE__)
#define FAIL_APR(s)     apr_error((s), __FILE__, __LINE__)
#define FAIL_SQLITE(c)  sqlite_error((c), __FILE__, __LINE__)

#ifdef ASSERT_ENABLED
#define ASSERT(cond)    \
    do {                \
        if (!(cond))    \
            assert_fail(APR_STRINGIFY(cond), __FILE__, __LINE__);   \
    } while (0)
#else
#define ASSERT(cond)
#endif

void apr_error(apr_status_t s, const char *file, int line_num) __attribute__((noreturn));
void sqlite_error(C4Runtime *c4, const char *file, int line_num) __attribute__((noreturn));
void simple_error(const char *file, int line_num) __attribute__((noreturn));
void var_error(const char *file, int line_num,
               const char *fmt, ...) __attribute__((format(printf, 3, 4), noreturn));

void assert_fail(const char *cond, const char *file, int line_num) __attribute__((noreturn));

#endif  /* ERROR_H */

#ifndef ERROR_H
#define ERROR_H

/*
 * Note that we include "fmt" in the variadic argument list, because C99
 * apparently doesn't allow variadic macros to be invoked without any vargs
 * parameters.
 */
#define ERROR(...)      var_error(__FILE__, __LINE__, __VA_ARGS__)
#define FAIL()          simple_error(__FILE__, __LINE__)
#define FAIL_APR(s)     apr_error((s), __FILE__, __LINE__)
#define FAIL_SQLITE(c)  sqlite_error((c), __FILE__, __LINE__)

#ifdef C4_ASSERT_ENABLED
#define ASSERT(cond)    \
    do {                \
        if (!(cond))    \
            assert_fail(APR_STRINGIFY(cond), __FILE__, __LINE__);   \
    } while (0)
#else
#define ASSERT(cond)
#endif

void apr_error(apr_status_t s, const char *file, int line_num) __attribute__((noreturn));
void sqlite_error(C4Runtime *c4, const char *file, int line_num) __attribute__((noreturn));
void simple_error(const char *file, int line_num) __attribute__((noreturn));
void var_error(const char *file, int line_num,
               const char *fmt, ...) __attribute__((format(printf, 3, 4), noreturn));

void assert_fail(const char *cond, const char *file, int line_num) __attribute__((noreturn));

#endif  /* ERROR_H */

Fix braindamage: assertions were not enabled in debug builds.


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

#pragma once

#include "Stdafx.h"
#include "Internals\MCefRefPtr.h"
#include "RequestContextSettings.h"
#include "include\cef_request_context.h"

using namespace CefSharp;

namespace CefSharp
{
    public ref class RequestContext
    {
    private:
        MCefRefPtr<CefRequestContext> _requestContext;
        RequestContextSettings^ _settings;
    public:
        RequestContext()
        {
            CefRequestContextSettings settings;
            _requestContext = CefRequestContext::CreateContext(settings, NULL);
        }

        RequestContext(RequestContextSettings^ settings) : _settings(settings)
        {
            _requestContext = CefRequestContext::CreateContext(settings, NULL);
        }

        !RequestContext()
        {
            _requestContext = NULL;
        }

        ~RequestContext()
        {
            this->!RequestContext();

            delete _settings;
        }

        operator CefRefPtr<CefRequestContext>()
        {
            return _requestContext.get();
        }
    };
}

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

#pragma once

#include "Stdafx.h"
#include "Internals\MCefRefPtr.h"
#include "RequestContextSettings.h"
#include "include\cef_request_context.h"

using namespace CefSharp;

namespace CefSharp
{
    public ref class RequestContext
    {
    private:
        MCefRefPtr<CefRequestContext> _requestContext;
        RequestContextSettings^ _settings;
    public:
        RequestContext()
        {
            CefRequestContextSettings settings;
            _requestContext = CefRequestContext::CreateContext(settings, NULL);
        }

        RequestContext(RequestContextSettings^ settings) : _settings(settings)
        {
            _requestContext = CefRequestContext::CreateContext(settings, NULL);
        }

        !RequestContext()
        {
            _requestContext = NULL;
        }

        ~RequestContext()
        {
            this->!RequestContext();

            delete _settings;
        }

        operator CefRefPtr<CefRequestContext>()
        {
            if(this == nullptr)
            {
                return NULL;
            }
            return _requestContext.get();
        }
    };
}

Add nullptr check and return NULL for implicitor operator when object is not initialized


/**
 * common.h
 *
 * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
 */

#ifndef GIT_STASHD_COMMON_H
#define GIT_STASHD_COMMON_H

#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define _GNU_SOURCE

#define NOOPT_FOUND_V -1
#define CLEAN_CATCH_V -2

#endif

/**
 * common.h
 *
 * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
 */

#ifndef GIT_STASHD_COMMON_H
#define GIT_STASHD_COMMON_H

#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define _GNU_SOURCE

#define NULL_BYTE 1
#define NOT_FOUND -1
#define ERR_CATCH -2

#endif

Add NULL_BYTE macro, rename others

Add NULL_BYTE macro, rename others


#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

FILE *fp_res;
int   xmain(void);

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    xmain();
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

FILE *fp_res;
int   xmain(void);

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    if (xmain() != 0) {
        return 99;
    }
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

Check xmain() return code in tests.

Check xmain() return code in tests.


// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE="%t/" LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s

int main(int argc, const char *argv[]) {
  if (argc < 2)
    return 1;
  return 0;
}
// CHECK: LLVM Profile: Failed to write file

// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t/ LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s

int main(int argc, const char *argv[]) {
  if (argc < 2)
    return 1;
  return 0;
}
// CHECK: LLVM Profile: Failed to write file

Remove quotes around env variable, NFC

[profile] Remove quotes around env variable, NFC

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


#include "output_http.h"
#include "output_ts_base.h"

namespace Mist{
  class OutHLS : public TSOutput{
  public:
    OutHLS(Socket::Connection &conn);
    ~OutHLS();
    static void init(Util::Config *cfg);
    void sendTS(const char *tsData, size_t len = 188);
    void sendNext();
    void onHTTP();
    bool isReadyForPlay();
    virtual void onFail(const std::string &msg, bool critical = false);

  protected:
    std::string h264init(const std::string &initData);
    std::string h265init(const std::string &initData);

    bool hasSessionIDs(){return !config->getBool("mergesessions");}
    std::string liveIndex();
    std::string liveIndex(size_t tid, const std::string &sessId);

    size_t vidTrack;
    size_t audTrack;
    uint64_t until;
  };
}// namespace Mist

typedef Mist::OutHLS mistOut;

#include "output_http.h"
#include "output_ts_base.h"

namespace Mist{
  class OutHLS : public TSOutput{
  public:
    OutHLS(Socket::Connection &conn);
    ~OutHLS();
    static void init(Util::Config *cfg);
    void sendTS(const char *tsData, size_t len = 188);
    void sendNext();
    void onHTTP();
    bool isReadyForPlay();
    virtual void onFail(const std::string &msg, bool critical = false);
    virtual std::string getStatsName(){return Output::getStatsName();}
  protected:
    std::string h264init(const std::string &initData);
    std::string h265init(const std::string &initData);

    bool hasSessionIDs(){return !config->getBool("mergesessions");}
    std::string liveIndex();
    std::string liveIndex(size_t tid, const std::string &sessId);

    size_t vidTrack;
    size_t audTrack;
    uint64_t until;
  };
}// namespace Mist

typedef Mist::OutHLS mistOut;

Fix HLS being seen as input during init

Fix HLS being seen as input during init


/*
 * arch/arm/mach-w90x900/include/mach/regs-usb.h
 *
 * Copyright (c) 2008 Nuvoton technology corporation.
 *
 * Wan ZongShun <mcuos.com@gmail.com>
 *
 * This program 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;version 2 of the License.
 *
 */

#ifndef __ASM_ARCH_REGS_USB_H
#define __ASM_ARCH_REGS_USB_H

/* usb Control Registers  */
#define USBH_BA		W90X900_VA_USBEHCIHOST
#define USBD_BA		W90X900_VA_USBDEV
#define USBO_BA		W90X900_VA_USBOHCIHOST

/* USB Host Control Registers */
#define REG_UPSCR0	(USBH_BA+0x064)
#define REG_UPSCR1	(USBH_BA+0x068)
#define REG_USBPCR0	(USBH_BA+0x0C4)
#define REG_USBPCR1	(USBH_BA+0x0C8)

/* USBH OHCI Control Registers */
#define REG_OpModEn	(USBO_BA+0x204)
/*This bit controls the polarity of over
*current flag from external power IC.
*/
#define OCALow		0x08

#endif /*  __ASM_ARCH_REGS_USB_H */

[ARM] 5499/1: Add Usb register controller header file dfine

Add Usb register controller header file dfine.
w90p910 usb ip is standard,but some mutifunction
controll pin must be special define in w90p910

Signed-off-by: Wan ZongShun <7d90017055ae88f9b614c1a99b7a29176cffa725@gmail.com>
Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>


#ifndef SKILLCOMPONENT_H_
#define SKILLCOMPONENT_H_

/**
 * Enumeration for identifying different skills.
 */
enum skill_t {
	Melee,
	Swords,
	BastardSword,
	Maces,
	SpikedMace,
	FirstAid
};

/**
 * Data structure to represent an Entity's skill.
 */
typedef struct
{
	skill_t skill; ///< The type of skill
	int ranks; ///< Current ranks in the skill
	int xp; ///< Amount of XP earned towards next rank
} SkillComponent;

#endif

#ifndef SKILLCOMPONENT_H_
#define SKILLCOMPONENT_H_

/**
 * Data structure to represent an Entity's skill.
 */
typedef struct
{
	int ranks; ///< Current ranks in the skill
	int xp; ///< Amount of XP earned towards next rank
} SkillComponent;

/**
 * Enumeration for identifying different skills.
 */
enum skill_t {
	NOSKILL,
	Melee,
	Swords,
	BastardSword,
	Maces,
	SpikedMace,
	FirstAid
};

/**
 * This array defines our parent skill relationships.
 *
 * If a skill's parent is NOSKILL, it has no parent.
 */
const skill_t* PARENT_SKILLS = { NOSKILL, NOSKILL, Melee, Swords, Melee, Maces, NOSKILL };

#endif

Add NOSKILL skill type, remove from component

The component will be going into a MultiComponentManager, so it will already be indexed by skill_t; storing skill_t in the component as well is redundant, unnecessary, and redundant.


// @(#)root/mc:$Name:  $:$Id: LinkDef.h,v 1.2 2002/04/26 08:46:10 brun Exp $
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ global gMC;

#pragma link C++ enum PDG_t;
#pragma link C++ enum TMCProcess;

#pragma link C++ class  TVirtualMC+;
#pragma link C++ class  TVirtualMCApplication+;
#pragma link C++ class  TVirtualMCStack+;
#pragma link C++ class  TVirtualMCDecayer+;

#endif

// @(#)root/mc:$Name:  $:$Id: LinkDef.h,v 1.2 2002/04/26 09:25:02 brun Exp $
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ global gMC;

#pragma link C++ enum PDG_t;
#pragma link C++ enum TMCProcess;

#pragma link C++ class  TVirtualMC+;
#pragma link C++ class  TVirtualMCApplication+;
#pragma link C++ class  TVirtualMCStack+;
#pragma link C++ class  TVirtualMCDecayer+;
#pragma link C++ class  TMCVerbose+;

#endif

Add TMCVerbose to the list of mc classes

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@6190 27541ba8-7e3a-0410-8455-c3a389f83636


#include <stdint.h>
#include "ports.h"
#include "pic.h"
#include "gdt.h"
#include "idt.h"
#include "irq.h"
#include "screen.h"

void entry(void) {
	pic_remap(IRQ0, IRQ8);
	pic_set_masks(0, 0);

	gdt_init((struct GDT *)(0x500));
	idt_init((struct IDT *)(0x500 + sizeof(struct GDT)));

	__asm__ __volatile__ ("sti");

	screen_init();

	__asm__ __volatile__ ("int $0x50");
	for(;;) { __asm__ __volatile__ ("hlt"); }
}

#include <stdint.h>
#include "ports.h"
#include "pic.h"
#include "gdt.h"
#include "idt.h"
#include "irq.h"
#include "screen.h"

void entry(void) {
	pic_remap(IRQ0, IRQ8);
	pic_set_masks(0, 0);
	idt_init((struct IDT *)(0x500));

	gdt_init((struct GDT *)(0x500 + sizeof(struct IDT)));

	__asm__ __volatile__ ("sti");

	screen_init();

	__asm__ __volatile__ ("int $0x50");
	for(;;) { __asm__ __volatile__ ("hlt"); }
}

Set up IDT first to ensure exceptions are handled


#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>

#define GITBUF 2048

int
main(int argc, char **argv)
{
  int pid, ret;
  int pipes[2];
  char gitbuff[GITBUF];
  size_t gitlen;
  char b;
  char *br;
  int childst;

  if(pipe(pipes) != 0)
  {
    perror("Error creating pipes");
    exit(1);
  }

  if((pid = fork()) == -1)
  {
    perror("Error forking git");
    exit(1);
  }

  if(pid == 0) //child
  {
    if(dup2(pipes[1], STDOUT_FILENO)  == -1)
    {
      perror("Error duplicating stdout");
      exit(1);
    }
    close(STDERR_FILENO);
    ret =  execlp("git", "git", "status", "-z", "-b", (char*)0);
  }

  waitpid(pid, &childst, 0);
  if(childst != 0) {
    exit(2);
  }

  gitlen = read(pipes[0], gitbuff, GITBUF);
  br = &gitbuff[3];
  putchar('(');

  while(*br != '\0')
  {
    // Three dots separate the branch from the tracking branch
    if(*br == '.' && *(br+1) == '.' && *(br+2) == '.') break;
    putchar(*br++);
  }

  putchar(')');
  putchar('\n');
}

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>

#define GITBUF 2048

int
main(int argc, char **argv)
{
  int pid, ret;
  int pipes[2];
  char gitbuff[GITBUF];
  size_t gitlen;
  char b;
  char *br;
  int childst;

  if(pipe(pipes) != 0)
  {
    perror("Error creating pipes");
    exit(1);
  }

  if((pid = fork()) == -1)
  {
    perror("Error forking git");
    exit(1);
  }

  if(pid == 0) //child
  {
    if(dup2(pipes[1], STDOUT_FILENO)  == -1)
    {
      perror("Error duplicating stdout");
      exit(1);
    }
    close(STDERR_FILENO);
    ret =  execlp("git", "git", "branch", "--list", (char*)0);
  }

  waitpid(pid, &childst, 0);
  if(childst != 0) {
    exit(2);
  }

  gitlen = read(pipes[0], gitbuff, GITBUF);
  br = gitbuff;
  putchar('(');

  while(*br++ != '*') {}
  // skip the '*' and the space after it
  br++;
  while(*br != '\n')
  {
    putchar(*br++);
  }

  putchar(')');
  putchar('\n');
}

Convert to `git branch` for performance

Convert to `git branch` for performance

 - Using `git status` is eificient to get only the current branch but in
   a repo with a large number of untracked files it can stall for a long
   time getting the status of a repository. Git Branch is much better in
   these cases.


// RUN: %ucc -o %t %s
// RUN: %ocheck 0 %t
// RUN: %t | %output_check 'Hello 5 2.3' 'Hello 5 2.3'

// should run without segfaulting
main()
{
	printf("Hello %d %.1f\n",
			5,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3); // this causes an infinite loop in glibc's printf()

	printf("Hello %d %.1f\n",
			5,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,  // this causes an infinite loop in glibc's printf()
			2.3); // and this causes a crash

	// suspect the bug is to do with double alignment when passed as stack arguments

	return 0;
}

Format strings and more through test for stack floats


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

#ifndef TEST_CORE_TSI_ALTS_FAKE_HANDSHAKER_FAKE_HANDSHAKER_SERVER_H
#define TEST_CORE_TSI_ALTS_FAKE_HANDSHAKER_FAKE_HANDSHAKER_SERVER_H

#include <memory>
#include <string>

#include <grpcpp/grpcpp.h>

namespace grpc {
namespace gcp {

// If max_expected_concurrent_rpcs is non-zero, the fake handshake service
// will track the number of concurrent RPCs that it handles and abort
// if if ever exceeds that number.
std::unique_ptr<grpc::Service> CreateFakeHandshakerService(
    int max_expected_concurrent_rpcs);

}  // namespace gcp
}  // namespace grpc

#endif  // TEST_CORE_TSI_ALTS_FAKE_HANDSHAKER_FAKE_HANDSHAKER_SERVER_H

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

#ifndef TEST_CORE_TSI_ALTS_FAKE_HANDSHAKER_FAKE_HANDSHAKER_SERVER_H
#define TEST_CORE_TSI_ALTS_FAKE_HANDSHAKER_FAKE_HANDSHAKER_SERVER_H

#include <memory>
#include <string>

#include <grpcpp/grpcpp.h>

namespace grpc {
namespace gcp {

// If max_expected_concurrent_rpcs is non-zero, the fake handshake service
// will track the number of concurrent RPCs that it handles and abort
// if if ever exceeds that number.
std::unique_ptr<grpc::Service> CreateFakeHandshakerService(
    int expected_max_concurrent_rpcs);

}  // namespace gcp
}  // namespace grpc

#endif  // TEST_CORE_TSI_ALTS_FAKE_HANDSHAKER_FAKE_HANDSHAKER_SERVER_H

Fix differing parameter name clang tidy warning


// 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 WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 0.004;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_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 WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 1.0;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

Increase the minimum interval for timers on background tabs to reduce
their CPU consumption.

The new interval is 1000 ms, or once per second. We can easily adjust
this value up or down, but this seems like a reasonable value to judge
the compatibility impact of this change.

BUG=66078
TEST=none (tested manually with minimal test case)

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

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


/*
 *  mswin32_config.h	Hand made MSWin32 configuration file.
 *	Copyright (c) 1996 Applied Logic Systems, Inc.
 *
 *  Author:	Chuck Houpt
 *  Creation:	1/30/96
 */

#include "dfltsys.h"

#define MSWin32 1
#define OSStr "mswin32"

#ifdef __GNUC__
#define EXTERNAL_STATE	1
#endif

/* Temp. disable threading until threading GUI stub is fixed */
#ifdef __GNUC__
#define Bytecode 1
#endif

#define HAVE_STDARG_H	1
#define HAVE_STDLIB_H	1
#define HAVE_FCNTL_H	1
#define HAVE_STRING_H	1
#define HAVE_SRAND		1

#define HAVE_TIME		1

#define HAVE_SOCKET		1
#define BERKELEY_SOCKETS	1
#define HAVE_SELECT		1
#define MISSING_UNIX_DOMAIN_SOCKETS 1

#define APP_PRINTF_CALLBACK	1

#define HAVE_STRCSPN	1
#define HAVE_STRSPN	1
#define HAVE_STRTOK	1

#define REVERSE_ENDIAN 1

/* The windows headers in Cygwin 1.3.4 are missing some prototypes,
   so define them here to silence the waring messages. */
#ifdef __GNUC__
extern __inline__ void* GetCurrentFiber(void);
extern __inline__ void* GetFiberData(void);
#endif

#include <winsock2.h>
#include <windows.h>

/*
 *  mswin32_config.h	Hand made MSWin32 configuration file.
 *	Copyright (c) 1996 Applied Logic Systems, Inc.
 *
 *  Author:	Chuck Houpt
 *  Creation:	1/30/96
 */

#include "dfltsys.h"

#define MSWin32 1
#define OSStr "mswin32"

#ifdef __GNUC__
#define EXTERNAL_STATE	1
#endif

/* Temp. disable threading until threading GUI stub is fixed */
#ifdef __GNUC__
#define Bytecode 1
#endif

#define HAVE_STDARG_H	1
#define HAVE_STDLIB_H	1
#define HAVE_FCNTL_H	1
#define HAVE_STRING_H	1
#define HAVE_SRAND		1

#define HAVE_TIME		1

#define HAVE_SOCKET		1
#define BERKELEY_SOCKETS	1
#define HAVE_SELECT		1
#define MISSING_UNIX_DOMAIN_SOCKETS 1

#define APP_PRINTF_CALLBACK	1

#define HAVE_STRCSPN	1
#define HAVE_STRSPN	1
#define HAVE_STRTOK	1

#define REVERSE_ENDIAN 1

#include <winsock2.h>
#include <windows.h>

Remove defunct missing defs that interfere with CI build


// 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_DESKTOP_NOTIFICATION_HANDLER_H_
#define CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_
#pragma once

#include "content/browser/renderer_host/render_view_host_observer.h"

class GURL;
struct DesktopNotificationHostMsg_Show_Params;

// Per-tab Desktop notification handler. Handles desktop notification IPCs
// coming in from the renderer.
class DesktopNotificationHandler : public RenderViewHostObserver {
 public:
  explicit DesktopNotificationHandler(RenderViewHost* render_view_host);
  virtual ~DesktopNotificationHandler();

 private:
  // RenderViewHostObserver implementation.
  virtual bool OnMessageReceived(const IPC::Message& message);

  // IPC handlers.
  void OnShow(const DesktopNotificationHostMsg_Show_Params& params);
  void OnCancel(int notification_id);
  void OnRequestPermission(const GURL& origin, int callback_id);

 private:
  DISALLOW_COPY_AND_ASSIGN(DesktopNotificationHandler);
};

#endif  // CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_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_DESKTOP_NOTIFICATION_HANDLER_H_
#define CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_
#pragma once

#include "content/browser/renderer_host/render_view_host_observer.h"

class GURL;
struct DesktopNotificationHostMsg_Show_Params;

// Per-tab Desktop notification handler. Handles desktop notification IPCs
// coming in from the renderer.
class DesktopNotificationHandler : public RenderViewHostObserver {
 public:
  explicit DesktopNotificationHandler(RenderViewHost* render_view_host);
  virtual ~DesktopNotificationHandler();

 private:
  // RenderViewHostObserver implementation.
  bool OnMessageReceived(const IPC::Message& message);

  // IPC handlers.
  void OnShow(const DesktopNotificationHostMsg_Show_Params& params);
  void OnCancel(int notification_id);
  void OnRequestPermission(const GURL& origin, int callback_id);

 private:
  DISALLOW_COPY_AND_ASSIGN(DesktopNotificationHandler);
};

#endif  // CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_

Revert 80939 - Fix clang error
TBR=jam@chromium.org

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


/**
 * Struct for IEEE EUI64 with network byte order and nx_structs.
 *
 * @author Raido Pahtma
 * @license MIT
 */
#ifndef NXIEEEEUI64_H
#define NXIEEEEUI64_H

#include "IeeeEui64.h"

typedef nx_struct nx_ieee_eui64 {
  nx_uint8_t data[IEEE_EUI64_LENGTH];
} nx_ieee_eui64_t;

#endif // NXIEEEEUI64_H

Add separate file for nx_ieee_eui64, since tinyos-main is unable to support it.


/* -*- c-basic-offset: 2 -*- */
/*
  Copyright(C) 2015 Brazil

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 2.1 as published by the Free Software Foundation.

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

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef GRN_REPORT_H
#define GRN_REPORT_H

#include "grn_ctx.h"

#ifdef __cplusplus
extern "C" {
#endif

const grn_log_level GRN_REPORT_INDEX_LOG_LEVEL;

void grn_report_index(grn_ctx *ctx,
                      const char *action,
                      const char *tag,
                      grn_obj *index);

#ifdef __cplusplus
}
#endif

#endif /* GRN_REPORT_H */

/* -*- c-basic-offset: 2 -*- */
/*
  Copyright(C) 2015 Brazil

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 2.1 as published by the Free Software Foundation.

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

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef GRN_REPORT_H
#define GRN_REPORT_H

#include "grn_ctx.h"

#ifdef __cplusplus
extern "C" {
#endif

extern const grn_log_level GRN_REPORT_INDEX_LOG_LEVEL;

void grn_report_index(grn_ctx *ctx,
                      const char *action,
                      const char *tag,
                      grn_obj *index);

#ifdef __cplusplus
}
#endif

#endif /* GRN_REPORT_H */

Add missing extern to variable in header

This missing extern causes following error in OSX:

```log
...
2403 warnings generated.
  CXXLD    libgroonga.la
duplicate symbol _GRN_REPORT_INDEX_LOG_LEVEL in:
    .libs/db.o
    .libs/expr.o
duplicate symbol _GRN_REPORT_INDEX_LOG_LEVEL in:
    .libs/db.o
    .libs/report.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [libgroonga.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
```


/**
 * \file thread_specific.h
 *
 * A thread specific type.
 *
 * \author eaburns
 * \date 2009-07-23
 */

#if !defined(_THREAD_SPECIFIC_H_)
#define _THREAD_SPECIFIC_H_

#include <vector>
using namespace std;

#include "thread.h"

/* To attempt to prevent cache ping-ponging? */
#define PADDING 24 		/* bytes */

template <class T>
class ThreadSpecific {
private:
	/* Ensure that the array is large enough for [tid] number of
	 * elements. */
	void ensure_size(unsigned int tid)
	{
		if (tid >= entries.size()) {
			struct padded_entry ent;
			ent.data = init_val;
			entries.resize(tid + 1, ent);
		}

	}
public:
	ThreadSpecific(T iv)
	{
		init_val = iv;
	}

	T get_value(void)
	{
		unsigned int tid = Thread::current()->get_id();
		ensure_size(tid);
		return entries[tid].data;
	}

	void set_value(T v)
	{
		unsigned int tid = Thread::current()->get_id();
		ensure_size(tid);
		entries[tid].data = v;
	}

	/**
	 * Get all entries.
	 */
	vector<T> get_all_entries(void)
	{
		typename vector<struct padded_entry>::iterator iter;
		vector<T> ret;

		for (iter = entries.begin(); iter != entries.end(); iter++)
			ret.push_back((*iter).data);

		return ret;
	}

private:
	T init_val;

	/* We want to try to get each element of the array on a
	 * seperate cache line. */
	struct padded_entry {
		T data;
		char padding[PADDING];
	};

	vector<struct padded_entry> entries;
};

#endif	/* !_THREAD_SPECIFIC_H_ */

Add the thread specific class.

Add the thread specific class.


// 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 CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_

#include <string>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/common/extensions/api/cryptotoken_private.h"
#include "extensions/browser/extension_function.h"

// Implementations for chrome.cryptotokenPrivate API functions.

namespace infobars {
class InfoBar;
}

namespace extensions {
namespace api {

class CryptotokenPrivateCanOriginAssertAppIdFunction
    : public UIThreadExtensionFunction {
  public:
    CryptotokenPrivateCanOriginAssertAppIdFunction();
    DECLARE_EXTENSION_FUNCTION("cryptotokenPrivate.canOriginAssertAppId",
                               CRYPTOTOKENPRIVATE_CANORIGINASSERTAPPID)
  protected:
    ~CryptotokenPrivateCanOriginAssertAppIdFunction() override {}
    ResponseAction Run() override;

  private:
    ChromeExtensionFunctionDetails chrome_details_;
};

}  // namespace api
}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_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 CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_

#include <string>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/common/extensions/api/cryptotoken_private.h"
#include "extensions/browser/extension_function.h"

// Implementations for chrome.cryptotokenPrivate API functions.

namespace extensions {
namespace api {

class CryptotokenPrivateCanOriginAssertAppIdFunction
    : public UIThreadExtensionFunction {
  public:
    CryptotokenPrivateCanOriginAssertAppIdFunction();
    DECLARE_EXTENSION_FUNCTION("cryptotokenPrivate.canOriginAssertAppId",
                               CRYPTOTOKENPRIVATE_CANORIGINASSERTAPPID)
  protected:
    ~CryptotokenPrivateCanOriginAssertAppIdFunction() override {}
    ResponseAction Run() override;

  private:
    ChromeExtensionFunctionDetails chrome_details_;
};

}  // namespace api
}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_

Remove an unneeded forward declaration.

Remove an unneeded forward declaration.

BUG=457769
R=pkasting@chromium.org,rockot@chromium.org

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

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#316348}


/* vi: set sw=4 ts=4: */
/*
 * getgid() for uClibc
 *
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */

#include "syscalls.h"
#include <unistd.h>

#if defined __NR_getxgid
# define __NR_getgid __NR_getxgid
#endif
_syscall0(gid_t, getgid);
libc_hidden_proto(getgid)
libc_hidden_def(getgid)

/* vi: set sw=4 ts=4: */
/*
 * getgid() for uClibc
 *
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */

#include "syscalls.h"
#include <unistd.h>

#if defined __NR_getxgid
# define __NR_getgid __NR_getxgid
#endif
libc_hidden_proto(getgid)
_syscall0(gid_t, getgid);
libc_hidden_def(getgid)

Make gcc4 happy as well

Make gcc4 happy as well


//
//  Marshal.h
//  Marshal
//
//  Created by Jason Larsen on 2/24/16.
//  Copyright © 2016 Utah iOS & Mac. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for Marshal.
FOUNDATION_EXPORT double MarshalVersionNumber;

//! Project version string for Marshal.
FOUNDATION_EXPORT const unsigned char MarshalVersionString[];

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

//
//  M A R S H A L
//
//       ()
//       /\
//  ()--'  '--()
//    `.    .'
//     / .. \
//    ()'  '()
//
//

#import <Foundation/Foundation.h>

//! Project version number for Marshal.
FOUNDATION_EXPORT double MarshalVersionNumber;

//! Project version string for Marshal.
FOUNDATION_EXPORT const unsigned char MarshalVersionString[];

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

Use Foundation to resolve macros instead of UIKit


//
//  IMeetingDelegate.h
//  MeetingApp
//
//  Created by Estefania Chavez Guardado on 2/27/16.
//  Copyright © 2016 Estefania Chavez Guardado. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "Meeting.h"

@protocol IMeetingDelegate <NSObject>

@optional

- (void) update: (MutableMeeting *) newMeeting;

- (void) moveToInactiveMeetings:(int) indexMeeting
          andInactiveTheMeeting: (NSString *) idMeeting;

- (void) updateDetail: (MutableMeeting *) meeting;

@end

//
//  IMeetingDelegate.h
//  MeetingApp
//
//  Created by Estefania Chavez Guardado on 2/27/16.
//  Copyright © 2016 Estefania Chavez Guardado. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "Meeting.h"

typedef enum  NotificationType {
    NOTIFICATION_TYPE_EMAIL,
    NOTIFICATION_TYPE_CALENDAR
} NotificationType;

@protocol IMeetingDelegate <NSObject>

@optional

- (void) update: (MutableMeeting *) newMeeting;

- (void) moveToInactiveMeetings:(int) indexMeeting
          andInactiveTheMeeting: (NSString *) idMeeting;

- (void) updateDetail: (MutableMeeting *) meeting;

// TODO: Send to update the notification
- (void) updateNotification: (NotificationType) type withCallback:(void (^)(BOOL updated)) callback;

@end

Define the method updateNotification in meetingbussiness


#ifndef ALEXCPT_H
#define ALEXCPT_H

#include <exception>
#include <string>

#include "AL/alc.h"

namespace al {

class backend_exception final : public std::exception {
    std::string mMessage;
    ALCenum mErrorCode;

public:
    backend_exception(ALCenum code, const char *msg, ...);

    const char *what() const noexcept override { return mMessage.c_str(); }
    ALCenum errorCode() const noexcept { return mErrorCode; }
};

} // namespace al

#define START_API_FUNC try

#define END_API_FUNC catch(...) { std::terminate(); }

#endif /* ALEXCPT_H */

#ifndef ALEXCPT_H
#define ALEXCPT_H

#include <exception>
#include <string>

#include "AL/alc.h"

#ifdef __GNUC__
#define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z))))
#else
#define ALEXCPT_FORMAT(x, y, z)
#endif

namespace al {

class backend_exception final : public std::exception {
    std::string mMessage;
    ALCenum mErrorCode;

public:
    backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4);

    const char *what() const noexcept override { return mMessage.c_str(); }
    ALCenum errorCode() const noexcept { return mErrorCode; }
};

} // namespace al

#define START_API_FUNC try

#define END_API_FUNC catch(...) { std::terminate(); }

#endif /* ALEXCPT_H */

Add the printf format attribute to backend_exception's constructor


// PARAM: --conf=conf/svcomp21.json
// from: ldv-linux-3.0/usb_urb-drivers-vhost-vhost_net.ko.cil.out.i
typedef unsigned long long u64;

int main( )
{ u64 a ;
  unsigned long flag ;
  unsigned long roksum ;
  struct thread_info *tmp___7 ;
  int tmp___8 ;
  long tmp___9;
  void *log_base;
  unsigned long sz;
  u64 addr;
  {
  a = (addr / 4096ULL) / 8ULL;
  if (a > (u64 )(0x0fffffffffffffffUL - (unsigned long )log_base)) {
    return (0);
  } else {
    if (a + (u64 )((unsigned long )log_base) > 0x0fffffffffffffffULL) {
      return (0);
    } else {
    }
  }
  {
  tmp___7 = current_thread_info();
  // __asm__ ("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0": "=&r" (flag), "=r" (roksum): "1" (log_base + a),
  //           "g" ((long )((((sz + 32768UL) - 1UL) / 4096UL) / 8UL)), "rm" (tmp___7->addr_limit.seg));
  }
  if (flag == 0UL) {
    tmp___8 = 1;
  } else {
    tmp___8 = 0;
  }
  {
  tmp___9 = __builtin_expect((long )tmp___8, 1L);
  }
  return ((int )tmp___9);
  }
}

Add failing test case with max u long long


// RUN: %clang -target arm-freebsd -mcpu=xscale -### -c %s 2>&1 | FileCheck %s
// CHECK-NOT: error: the clang compiler does not support '-mcpu=xscale'
// CHECK: "-cc1"{{.*}} "-target-cpu" "xscale"{{.*}}

Add a clang test for r257376 (Ensure -mcpu=xscale works for arm targets).

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


//
//  CDZIssueSyncEngine.h
//  thingshub
//
//  Created by Chris Dzombak on 1/13/14.
//  Copyright (c) 2014 Chris Dzombak. All rights reserved.
//

#import <ReactiveCocoa/ReactiveCocoa.h>

@class OCTClient;
@class CDZThingsHubConfiguration;
@protocol CDZIssueSyncDelegate;

@interface CDZIssueSyncEngine : NSObject

/// Designated initializer
- (instancetype)initWithDelegate:(id<CDZIssueSyncDelegate>)delegate
                   configuration:(CDZThingsHubConfiguration *)config
             authenticatedClient:(OCTClient *)client;

/// Returns a signal which will either complete or error after the sync operation.
- (RACSignal *)sync;

@end

//
//  CDZIssueSyncEngine.h
//  thingshub
//
//  Created by Chris Dzombak on 1/13/14.
//  Copyright (c) 2014 Chris Dzombak. All rights reserved.
//

#import <ReactiveCocoa/ReactiveCocoa.h>

@class OCTClient;
@class CDZThingsHubConfiguration;
@protocol CDZIssueSyncDelegate;

@interface CDZIssueSyncEngine : NSObject

/// Designated initializer
- (instancetype)initWithDelegate:(id<CDZIssueSyncDelegate>)delegate
                   configuration:(CDZThingsHubConfiguration *)config
             authenticatedClient:(OCTClient *)client;

/// Returns a signal which will asynchronously return strings as status updates,
/// and either complete or error after the sync operation.
- (RACSignal *)sync;

@end

Update sync method docs in IssueSyncEngine


/* Auxiliary program: write the include file for determining
   PLplot's floating-point type
*/

#include <stdio>
#include <stdlib>
#include "plConfig.h"

main(int argc, char *argv[] )
{
   FILE *outfile ;
   char *kind ;

   outfile = fopen( "plflt.inc", "w" ) ;
#ifdef PL_DOUBLE
   kind = "1.0d0"
#else
   kind = "1.0"
#endif

   fprintf{ outfile, "\
! NOTE: Generated code\n\
!\n\
! Type of floating-point numbers in PLplot\n\
!\n\
      integer, parameter :: plf   = kind(%s)\n\
      integer, parameter :: plflt = plf\n", kind ) ;
  fclose( outfile ) ;
}

/* Auxiliary program: write the include file for determining
   PLplot's floating-point type
*/

#include <stdio.h>
#include <stdlib.h>
#include "plConfig.h"

main(int argc, char *argv[] )
{
   FILE *outfile;
   char *kind;

   outfile = fopen( "plflt.inc", "w" ) ;
#ifdef PL_DOUBLE
   kind = "1.0d0";
#else
   kind = "1.0";
#endif

   fprintf( outfile, "C     NOTE: Generated code\n");
   fprintf( outfile, "C\n");
   fprintf( outfile, "C     Type of floating-point numbers in PLplot\n");
   fprintf( outfile, "C\n");
   fprintf( outfile, "      integer, parameter :: plf   = kind(%s)\n", kind);
   fprintf( outfile, "      integer, parameter :: plflt = plf\n");
   fclose( outfile);
}

Fix large number of syntax errors (at least for gcc).

svn path=/trunk/; revision=6508


#ifndef LIBPORT_UNISTD_H
# define LIBPORT_UNISTD_H

# include "detect_win32.h"

# include "libport/config.h"

// This is traditional Unix file.
# ifdef LIBPORT_HAVE_UNISTD_H
#  include "unistd.h"
# endif

// This seems to be its WIN32 equivalent.
// http://msdn2.microsoft.com/en-us/library/ms811896(d=printer).aspx#ucmgch09_topic7.
# if defined WIN32 || defined LIBPORT_WIN32
#  include "io.h"
# endif

#if defined LIBPORT_HAVE__GETCWD
# define getcwd _getcwd
#elif !defined LIBPORT_HAVE_GETCWD
# error I need either getcwd() or _getcwd()
#endif

#endif // !LIBPORT_UNISTD_H

#ifndef LIBPORT_UNISTD_H
# define LIBPORT_UNISTD_H

# include "detect_win32.h"

# include "libport/config.h"

// This is traditional Unix file.
# ifdef LIBPORT_HAVE_UNISTD_H
#  include "unistd.h"
# endif

// This seems to be its WIN32 equivalent.
// http://msdn2.microsoft.com/en-us/library/ms811896(d=printer).aspx#ucmgch09_topic7.
# if defined WIN32 || defined LIBPORT_WIN32
#  include "io.h"
# endif

#if defined LIBPORT_URBI_ENV_AIBO
static char *getcwd(char *buf, size_t size)
{
  if (buf == 0 || size <= 3)
    return 0;
  strncpy (buf, "/MS", size);
  return buf;
}
#else
# if defined LIBPORT_HAVE__GETCWD
#  define getcwd _getcwd
# elif !defined LIBPORT_HAVE_GETCWD
#  error I need either getcwd() or _getcwd()
# endif
#endif

#endif // !LIBPORT_UNISTD_H

Add dummy static version of getcwd for Aibo.

	* include/libport/unistd.h: Here.


#import "NSManagedObject+ActiveRecord.h"
#import "NSString+StringBetweenStrings.h"
#import <Artsy+UIColors/UIColor+ArtsyColors.h>
#import "UIColor+FolioColours.h"
#import <Artsy+UIFonts/UIFont+ArtsyFonts.h>
#import "NSObject+Notifications.h"
#import <UIView+BooleanAnimations/UIView+BooleanAnimations.h>
#import "UIButton+FolioButtons.h"
#import "UIColor+DebugColours.h"
#import "NSString+StringSize.h"
#import "UIBarButtonItem+toolbarHelpers.h"
#import "UIImageView+ArtsySetURL.h"

#import "NSManagedObject+ActiveRecord.h"
#import "NSString+StringBetweenStrings.h"
#import <Artsy+UIColors/UIColor+ArtsyColors.h>
#import "UIColor+FolioColours.h"

#if __has_include(<Artsy+UIFonts/UIFont+ArtsyFonts.h>)
#import <Artsy+UIFonts/UIFont+ArtsyFonts.h>
#endif

#if __has_include(<Artsy+OSSUIFonts/UIFont+OSSArtsyFonts.h>)
#import <Artsy+OSSUIFonts/UIFont+OSSArtsyFonts.h>
#endif

#import "NSObject+Notifications.h"
#import <UIView+BooleanAnimations/UIView+BooleanAnimations.h>
#import "UIButton+FolioButtons.h"
#import "UIColor+DebugColours.h"
#import "NSString+StringSize.h"
#import "UIBarButtonItem+toolbarHelpers.h"
#import "UIImageView+ArtsySetURL.h"

Support running from the OSS fonts

Support running from the OSS fonts


file4.c - r1
Test checkin in master1-updated - updated_by_master
Test checkin in master2
Test checkin in master3
Test checkin in master4

Test checkin in master1-updated - updated_by_master
Test checkin in master1-updated - updated2
Test checkin in master2
Test checkin in master3
Test checkin in master4

Test commit merges feature to master

Test commit merges feature to master


// Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "iree-dialects/Transforms/Listener.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Rewrite/FrozenRewritePatternSet.h"

namespace mlir {
struct GreedyRewriteConfig;

/// Applies the specified patterns on `op` alone while also trying to fold it,
/// by selecting the highest benefits patterns in a greedy manner. Returns
/// success if no more patterns can be matched. `erased` is set to true if `op`
/// was folded away or erased as a result of becoming dead. Note: This does not
/// apply any patterns recursively to the regions of `op`. Accepts a listener
/// so the caller can be notified of rewrite events.
LogicalResult applyPatternsAndFoldGreedily(
    MutableArrayRef<Region> regions, const FrozenRewritePatternSet &patterns,
    const GreedyRewriteConfig &config, RewriteListener *listener);
inline LogicalResult applyPatternsAndFoldGreedily(
    Operation *op, const FrozenRewritePatternSet &patterns,
    const GreedyRewriteConfig &config, RewriteListener *listener) {
  return applyPatternsAndFoldGreedily(op->getRegions(), patterns, config,
                                      listener);
}

} // namespace mlir

// Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "iree-dialects/Transforms/Listener.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Rewrite/FrozenRewritePatternSet.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"

namespace mlir {
struct GreedyRewriteConfig;

/// Applies the specified patterns on `op` alone while also trying to fold it,
/// by selecting the highest benefits patterns in a greedy manner. Returns
/// success if no more patterns can be matched. `erased` is set to true if `op`
/// was folded away or erased as a result of becoming dead. Note: This does not
/// apply any patterns recursively to the regions of `op`. Accepts a listener
/// so the caller can be notified of rewrite events.
LogicalResult applyPatternsAndFoldGreedily(
    MutableArrayRef<Region> regions, const FrozenRewritePatternSet &patterns,
    const GreedyRewriteConfig &config, RewriteListener *listener);
inline LogicalResult applyPatternsAndFoldGreedily(
    Operation *op, const FrozenRewritePatternSet &patterns,
    const GreedyRewriteConfig &config, RewriteListener *listener) {
  return applyPatternsAndFoldGreedily(op->getRegions(), patterns, config,
                                      listener);
}

} // namespace mlir

Add include for GreedyPatternRewriteDriver implementation.

Not sure if this is correct. There was an unresolved symbol error on MSVC that this fixes though.


#pragma once

#define DHT22_PIN 6
#define DHT22_SAMPLE_RATE 3000

#define TEMPORATURE_TARGET (204)

#define HEATER_PIN 10
#define HEATER_ACTION_DELAY (15*60) // minimal seconds to open/close heater, prevent switch heater too frequently.

#pragma once

#define DHT22_PIN 6
#define DHT22_SAMPLE_RATE 20000

#define TEMPORATURE_TARGET (204)

#define HEATER_PIN 10
#define HEATER_ACTION_DELAY (15*60) // minimal seconds to open/close heater, prevent switch heater too frequently.

Change DHT22 sensor sample rate to 20 seconds

3 seconds is used for debug purpose


#ifndef VECTOR_3D_H
#define VECTOR_3D_H

#include <math.h>

namespace classes {
	struct Point3D {
		double x, y, z;
	};

	class Vector3D {
		struct Cheshire;
		Cheshire* smile;

		static const Point3D nullPoint = { 0.0, 0.0, 0.0 };

		public:
			Vector3D();
			Vector3D(Point3D point = nullPoint);
			Vector3D(double x = 0.0, double y = 0.0, double z = 0.0);
			~Vector3D();
			double		getModule() const;
			Vector3D	copy() const;
			Vector3D	getReversed() const;
			void		multiplyByScalar(const double);
			void		normalize();
			void		print() const;

			static		Vector3D	add(Vector3D&, Vector3D&);
			static		Vector3D	substract(Vector3D&, Vector3D&);
			static		Vector3D	vectorMultiply(Vector3D&, Vector3D&) ;
			static		double		scalarMultiply(Vector3D&, Vector3D&);
			static		double		sin(Vector3D&, Vector3D&);
			static		double		cos(Vector3D&, Vector3D&);
			static		double		angle(Vector3D&, Vector3D&);
	};
}

#endif // VECTOR_3D_H

#ifndef VECTOR_3D_H
#define VECTOR_3D_H

#include <math.h>

namespace classes {
	struct Point3D {
		double x, y, z;
	};

	typedef const char* err;

	class Vector3D {
		struct Cheshire;
		Cheshire* smile;

		static const Point3D nullPoint;
		static unsigned int idCounter;

		public:
			Vector3D(Point3D point = nullPoint);
			Vector3D(double x, double y = 0.0, double z = 0.0);
			~Vector3D();
	inline	double			getModule() const;
	inline	void			print()		const;
	inline 	const Point3D&	getPoint()	const;
			Vector3D		copy()		const;
			void			multiplyByScalar(const double);
			void			normalize();

	static 	Vector3D	add(Vector3D&, Vector3D&);
	static	Vector3D	substract(Vector3D&, Vector3D&);
	static	Vector3D	vectorMultiply(Vector3D&, Vector3D&) ;
	static	double		scalarMultiply(Vector3D&, Vector3D&);
	static	double		sin(Vector3D&, Vector3D&);
	static	double		cos(Vector3D&, Vector3D&);
	static	double		angle(Vector3D&, Vector3D&);
	};
}

#endif // VECTOR_3D_H

Change signatures of methods and fields of class


/**
 * Exemplo 01 - Hello World!
 *
 * Este é o exemplo mais simples da linguagem C. Consiste apenas em um programa que
 * imprime a mensagem "Hello World!" e termina sua execução.
 * Apesar de simples, é um bom programa para se basear na estrutura, além de testar
 * se o compilador está funcionando corretamente
 */

#include <stdio.h>

int main(void)
{
	puts("Hello World!");
	return 0;
}

Add first example! (Hello World)

Add first example! (Hello World)


#include "calc.h"

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

int calc(const char* p)
{
    int i;
    int ans;

    ans = atoi(p);
    i = 0;
    while (p[i] != '\0'){
        while (isdigit(p[i])){
            i++;
        }
        switch (p[i]){
            case '+':
                return (ans + calc(p + i + 1));
            case '-':
                return (ans - calc(p + i + 1));
            case '*':
                ans *= atoi(p + i + 1);
                i++;
                break;
            case '/':
                ans /= atoi(p + i + 1);
                i++;
                break;
            case '\0':
                return (ans);
            default:
                puts("Error");
                return (0);
        }
    }
}

#include "calc.h"

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

int calc(const char* p)
{
    int i;
    int ans;

    ans = atoi(p);
    i = 0;
    while (p[i] != '\0'){
        while (isdigit(p[i])){
            i++;
        }
        switch (p[i]){
            case '+':
                return (ans + calc(p + i + 1));
            case '-':
                return (ans - calc(p + i + 1));
            case '*':
                ans *= atoi(p + i + 1);
                i++;
                break;
            case '/':
                ans /= atoi(p + i + 1);
                i++;
                break;
            case '\0':
                return (ans);
            default:
                puts("Error");
                return (0);
        }
    }

    return (ans);
}

Return answer when reading formula was finished


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

#include "opt_acpi.h"	/* XXX trim includes */
#include <sys/param.h>
#include <sys/mutex.h>
#include <sys/bus.h>

#include "acpi.h"

#include <dev/acpica/acpivar.h>

static int powerprofile_state = POWERPROFILE_PERFORMANCE;

int
powerprofile_get_state(void)
{
    return(powerprofile_state);
}

void
powerprofile_set_state(int state)
{
    int		changed;

    ACPI_LOCK;
    if (state != powerprofile_state) {
	powerprofile_state = state;
	changed = 1;
	printf("system power profile changed to '%s'\n",
	       (state == POWERPROFILE_PERFORMANCE) ? "performance" : "economy");
    } else {
	changed = 0;
    }
    ACPI_UNLOCK;
    if (changed)
	EVENTHANDLER_INVOKE(powerprofile_change);
}

Support for system "power profiles". Currently we support two profiles; "economy" and "performance".