#include <stdio.h>

int main(int argc, char** argv) {
    if (argc < 2) {
        printf("Too few arguments\n");
        return 1;
    }

    char* word = argv[1];
    // Length AFTER replacing ' ' with "%20", counting '\0'
    int rlen = 1;
    // Determine length of new word
    for (int i = 0; word[i]; ++i) {
        rlen += (word[i] == ' ') ? 3 : 1;
    }

    char rstr[rlen];

    int ridx = 0;
    for (int i = 0; word[i]; ++i) {
        if (word[i] == ' ') {
            rstr[ridx] = '%';
            rstr[ridx + 1] = '2';
            rstr[ridx + 2] = '0';
            ridx += 3;
        }
        else {
            rstr[ridx] = word[i];
            ridx += 1;
        }
    }

    // Always null terminate :)
    rstr[rlen - 1] = '\0';
    printf("Replaced string is %s.\n", rstr);

    return 0;
}

Replace spaces with "%20" in a string

Replace spaces with "%20" in a string


// Copyright (c) 2012-2013, the scalloc Project Authors.  All rights reserved.
// Please see the AUTHORS file for details.  Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.

#ifndef SCALLOC_ALLOCATORS_PAGE_HEAP_H_
#define SCALLOC_ALLOCATORS_PAGE_HEAP_H_

#include "common.h"
#include "distributed_queue.h"

namespace scalloc {

class PageHeap {
 public:
  static void InitModule();
  static PageHeap* GetHeap();

  void* Get();
  void Put(void* p);
  void AsyncRefill();

 private:
  static const size_t kPageHeapBackends = 4;
  static const size_t kPageRefill = 4;

  static PageHeap page_heap_ cache_aligned;

  DistributedQueue page_pool_ cache_aligned;
};

always_inline PageHeap* PageHeap::GetHeap() {
  return &page_heap_;
}

always_inline void PageHeap::Put(void* p) {
  page_pool_.Enqueue(p);
}

always_inline void* PageHeap::Get() {
 REDO:
  void* result = page_pool_.Dequeue();
  if (UNLIKELY(result == NULL)) {
    AsyncRefill();
    goto REDO;
  }
  return result;
}

}  // namespace scalloc

#endif  // SCALLOC_ALLOCATORS_PAGE_HEAP_H_

// Copyright (c) 2012-2013, the scalloc Project Authors.  All rights reserved.
// Please see the AUTHORS file for details.  Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.

#ifndef SCALLOC_ALLOCATORS_PAGE_HEAP_H_
#define SCALLOC_ALLOCATORS_PAGE_HEAP_H_

#include "common.h"
#include "distributed_queue.h"

namespace scalloc {

class PageHeap {
 public:
  static void InitModule();
  static PageHeap* GetHeap();

  void* Get();
  void Put(void* p);
  void AsyncRefill();

 private:
  static const size_t kPageHeapBackends = 4;
  static const size_t kPageRefill = 24;

  static PageHeap page_heap_ cache_aligned;

  DistributedQueue page_pool_ cache_aligned;
};

always_inline PageHeap* PageHeap::GetHeap() {
  return &page_heap_;
}

always_inline void PageHeap::Put(void* p) {
  LOG(kTrace, "[PageHeap]: put: %p", p);
  page_pool_.Enqueue(p);
}

always_inline void* PageHeap::Get() {
 REDO:
  void* result = page_pool_.Dequeue();
  if (UNLIKELY(result == NULL)) {
    AsyncRefill();
    goto REDO;
  }
  LOG(kTrace, "[PageHeap]: get: %p", result);
  return result;
}

}  // namespace scalloc

#endif  // SCALLOC_ALLOCATORS_PAGE_HEAP_H_

Increase refill and add logging.

PageHeap: Increase refill and add logging.

Signed-off-by: Michael Lippautz <0d543840881a2c189b4f7636b15eebd6a8f60ace@gmail.com>


#ifndef EGLTYPEDEFS_INCLUDED
#define EGLTYPEDEFS_INCLUDED

#include <GL/egl.h>

typedef struct _egl_config _EGLConfig;

typedef struct _egl_context _EGLContext;

typedef struct _egl_display _EGLDisplay;

typedef struct _egl_driver _EGLDriver;

typedef struct _egl_mode _EGLMode;

typedef struct _egl_screen _EGLScreen;

typedef struct _egl_surface _EGLSurface;

typedef void (*_EGLProc)();

typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy);

#endif /* EGLTYPEDEFS_INCLUDED */

#ifndef EGLTYPEDEFS_INCLUDED
#define EGLTYPEDEFS_INCLUDED

#include <GLES/egl.h>

typedef struct _egl_config _EGLConfig;

typedef struct _egl_context _EGLContext;

typedef struct _egl_display _EGLDisplay;

typedef struct _egl_driver _EGLDriver;

typedef struct _egl_mode _EGLMode;

typedef struct _egl_screen _EGLScreen;

typedef struct _egl_surface _EGLSurface;

typedef void (*_EGLProc)();

typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy);

#endif /* EGLTYPEDEFS_INCLUDED */

Fix include path to make build work

Fix include path to make build work


#include <stdio.h>
#include "y.tab.h"

int main(int argc, char ** argv)
{
    if(argc > 1)
    {
        yyin = fopen(argv[1], "r");
        if(yyin == NULL)
        {
            printf("File doesn't exits.\n");
            return 1;
        }
        strcpy(file_name, argv[1]);

        if(argc > 2)
        {
            if(strcmp(argv[2], "-print-tree") == 0)
                is_to_print = true;

        }
    }
    read_file();
    yyparse();
    if(!has_error)
        printf("\033[1;32mCompile Success!\033[0m\n");
    return 0;
}

#include <stdio.h>
#include "list.h"
#include "syntax.h"
#include "scc_yacc.hpp"

extern FILE * yyin;
extern char *file_content[1024];
extern char file_name[1024];
extern int yyparse();

void read_file()
{
    for(int i = 0; !feof(yyin); i++)
    {
        file_content[i] = (char * )malloc(1024 * sizeof(char));
        fgets(file_content[i], 1024, yyin);
        file_content[i][strlen(file_content[i]) - 1] = '\0';
    }
    fseek(yyin, 0, 0);
}

int main(int argc, char ** argv)
{
    // read from file
    if(argc > 1)
    {
        strcpy(file_name, argv[1]);
        yyin = fopen(argv[1], "r");
        if(yyin == NULL)
        {
            printf("File doesn't exits.\n");
            return 1;
        }
    }
    // TODO: macro expansion

    // grammer analysis
    read_file();
    if(yyparse() != 0)
        return 0;

    // semantic analysis

    printf("\033[1;32mCompile Success!\033[0m\n");
    return 0;
}

Clean yacc file, move other functions out of it.


#ifndef VAST_UTIL_BROCCOLI_H
#define VAST_UTIL_BROCCOLI_H

#include <ze/fwd.h>
#include "vast/util/server.h"

// Forward declaration.
struct bro_conn;

namespace vast {
namespace util {
namespace broccoli {

struct connection;
typedef util::server<connection> server;
typedef std::function<void(ze::event)> event_handler;

/// Initializes Broccoli. This function must be called before any other call
/// into the Broccoli library.
/// @param messages If `true`, show message contents and protocol details.
/// @param calltrace If `true`, enable call tracing.
void init(bool messages = false, bool calltrace = false);

/// A Broccoli connection actor.
struct connection : cppa::sb_actor<connection>
{
  /// Spawns a new Broccoli connection.
  /// @param The input stream to read data from.
  /// @param The output stream to read data from.
  connection(
      cppa::network::input_stream_ptr in,
      cppa::network::output_stream_ptr out);

  struct bro_conn* bc_;
  cppa::network::input_stream_ptr in_;
  cppa::network::output_stream_ptr out_;
  event_handler event_handler_;
  //std::vector<ze::event> events_;
  cppa::behavior init_state;
};

} // namespace broccoli
} // namespace vast
} // namespace util

#endif

#ifndef VAST_UTIL_BROCCOLI_H
#define VAST_UTIL_BROCCOLI_H

#include <ze/fwd.h>
#include "vast/util/server.h"

namespace vast {
namespace util {
namespace broccoli {

// Forward declarations.
struct bro_conn;
struct connection;
typedef util::server<connection> server;
typedef std::function<void(ze::event)> event_handler;

/// Initializes Broccoli. This function must be called before any other call
/// into the Broccoli library.
/// @param messages If `true`, show message contents and protocol details.
/// @param calltrace If `true`, enable call tracing.
void init(bool messages = false, bool calltrace = false);

/// A Broccoli connection actor.
struct connection : cppa::sb_actor<connection>
{
  /// Spawns a new Broccoli connection.
  /// @param The input stream to read data from.
  /// @param The output stream to read data from.
  connection(
      cppa::network::input_stream_ptr in,
      cppa::network::output_stream_ptr out);

  struct bro_conn* bc_;
  cppa::network::input_stream_ptr in_;
  cppa::network::output_stream_ptr out_;
  event_handler event_handler_;
  //std::vector<ze::event> events_;
  cppa::behavior init_state;
};

} // namespace broccoli
} // namespace vast
} // namespace util

#endif

Move forward decls in right namespace.

Move forward decls in right namespace.


#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

FILE *os_fopen(const char *path, const char *mode)
{
    return fopen(path, mode);
}

int os_set_non_blocking(FILE *stream)
{
    (void)stream;
    /* TODO support non-blocking (overlapped ?) file handles */
    return 1; // return failure for now
}

Add no-op Win32 impl for non-blocking fd


/*****************************************************************************
* PROGRAM NAME: CUDFunction.h
* PROGRAMMER: Wei Sun	wsun@vt.edu
* PURPOSE: Define the user defined function object
*****************************************************************************/
#ifndef COPASI_CUDFunction
#define	COPASI_CUDFunction

#include <string>

#include "copasi.h"
#include "utilities/utilities.h"
#include "function/CBaseFunction.h"
#include "CNodeO.h"

class CUDFunction: public CBaseFunction
{
 private:
  /**
   *  The vector of nodes of the binary tree of the function
   */
  CCopasiVectorS < CNodeO > mNodes;
  /**
   *  Internal variable
   */
  unsigned C_INT32 mNidx;

 public:
  /**
   *  Default constructor
   */
  CUDFunction();

  /**
   *  This creates a user defined function with a name an description
   *  @param "const string" &name
   *  @param "const string" &description
   */
  CUDFunction(const string & name,
	       const string & description);

  /**
   *  Destructor
   */
  ~CUDFunction();

  /**
   *  Delete
   */
  void cleanup();

  /**
   *  Copy
   */
  void copy(const CUDFunction & in);

  /**
   *  Loads an object with data coming from a CReadConfig object.
   *  (CReadConfig object reads an input stream)
   *  @param pconfigbuffer reference to a CReadConfig object.
   *  @return Fail
   */
  C_INT32 load(CReadConfig & configbuffer,
	       CReadConfig::Mode mode = CReadConfig::LOOP);

  /**
   *  Saves the contents of the object to a CWriteConfig object.
   *  (Which usually has a file attached but may also have socket)
   *  @param pconfigbuffer reference to a CWriteConfig object.
   *  @return Fail
   */
  C_INT32 save(CWriteConfig & configbuffer);

  /**
   *  This retrieves the node tree of the function
   *  @return "CCopasiVectorS < CNodeO > &"
   */
  CCopasiVectorS < CNodeO > & nodes();

 private:
  /**
   *  This clears all nodes of the function tree
   */
  void clearNodes();

  /**
   *  This  connects the nodes to build the binary function tree
   */
  C_INT32 connectNodes();

  CNodeO * parseExpression(C_INT16 priority);

  CNodeO * parsePrimary();
};

#endif

Define the user defined functions

Define the user defined functions


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
        int data;
        struct node *next;
};
struct node *createNode (int value) {
        struct node *newNode = (struct node *) malloc (sizeof (struct node));
        newNode -> data = value;
        newNode -> next = NULL;
        return newNode;
}
void insertNode (struct node **head_ref, struct node **tail_ref, int value) {
        struct node *newNode = createNode (value);
        if (*head_ref == NULL) {
                *head_ref = newNode;
                *tail_ref = newNode;
}
        else {
                (*tail_ref) -> next = newNode;
                *tail_ref = newNode;
}
}
void  printList (struct node *head) {
        while (head != NULL) {
                printf ("%d -> ", head->data);
                head = head->next;
}
        printf ("NULL\n");
}
void destroyList (struct node *head) {
        struct node *nextNode = head;
        while (head != NULL) {
                nextNode = head -> next;
                free (head);
                head = nextNode;
}
        printf("Destroyed it\n" );
}
void splitEveryNodeOnOddEvenData (struct node **head_ref) {
        struct node *currentNode = NULL;
        struct node *nextNode = NULL;
        struct node *newNode = NULL;
        int element;
        currentNode = (*head_ref);
        if (currentNode == NULL) {
                return;
}
        while (currentNode != NULL) {
                nextNode = currentNode->next;
                element = currentNode->data;
                if (element % 2 == 0) {
                        newNode = createNode (element/2);
                        currentNode->data /= 2;
}
                else {
                        newNode = createNode (element - element/2);
                        currentNode->data /= 2;
}
        currentNode->next = newNode;
        newNode->next = nextNode;
        currentNode = nextNode;
}
}
int main (int argc, char *argv[]) {
        int value;
        struct node *head = NULL;
        struct node *tail = NULL;
        char buffer[2048];
        char *p = NULL;

        fgets (buffer, 2048, stdin);
        p = strtok (buffer, "NULL > | \n");
        while (p != NULL) {
                sscanf (p, "%d", &value);
                insertNode (&head, &tail, value);
                p = strtok (NULL, "NULL null | > \n");
}
        printList (head);
        splitEveryNodeOnOddEvenData (&head);
        printList (head);
        destroyList (head);
        head = NULL;
        tail = NULL;
        return 0;
}

Split every node into two based on node data

Split every node into two nodes based on data of the node. If the data is odd, the second node gets the greater half.


#include <stdio.h>
#include "libsass/sass_interface.h"

int main(int argc, char** argv)
{
	if (argc < 2) {
		printf("Usage: sassc [INPUT FILE]\n");
		return 0;
	}

	struct sass_file_context* ctx = sass_new_file_context();
	ctx->options.include_paths = "";
	ctx->options.image_path = "images";
	ctx->options.output_style = SASS_STYLE_NESTED;
	ctx->input_path = argv[1];

	sass_compile_file(ctx);

	if (ctx->error_status) {
		if (ctx->error_message)
			printf("%s", ctx->error_message);
		else
			printf("An error occured; no error message available.\n");
	}
	else if (ctx->output_string) {
		printf("%s", ctx->output_string);
	}
	else {
		printf("Unknown internal error.\n");
	}

	sass_free_file_context(ctx);
	return 0;
}

#include <stdio.h>
#include "libsass/sass_interface.h"

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

	if (argc < 2) {
		printf("Usage: sassc [INPUT FILE]\n");
		return 0;
	}

	struct sass_file_context* ctx = sass_new_file_context();
	ctx->options.include_paths = "";
	ctx->options.image_path = "images";
	ctx->options.output_style = SASS_STYLE_NESTED;
	ctx->input_path = argv[1];

	sass_compile_file(ctx);

	if (ctx->error_status) {
		if (ctx->error_message)
			printf("%s", ctx->error_message);
		else
			printf("An error occured; no error message available.\n");
		ret = 1;
	}
	else if (ctx->output_string) {
		printf("%s", ctx->output_string);
		ret = 0;
	}
	else {
		printf("Unknown internal error.\n");
		ret = 2;
	}

	sass_free_file_context(ctx);
	return ret;
}

Exit with an error code when an error occurs.


// PARAM: --enable ana.sv-comp.enabled --enable ana.sv-comp.functions --set ana.specification 'CHECK( init(main()), LTL(G ! call(reach_error())) )' --enable ana.int.interval
// previously both branches dead
// simplified from 28-race_reach/06-cond_racing1
#include <pthread.h>
#include <assert.h>

int __VERIFIER_nondet_int();

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

int main() {
  int i = __VERIFIER_nondet_int();

  if (i) pthread_mutex_lock(&mutex);

  if (i)
    assert(1); // reachable
  else
    assert(1); // reachable

  assert(1); // reachable

  return 0;
}

Add witness lifter path sensitive unsound branch test


//
//  RocksDBPrefixExtractor.h
//  ObjectiveRocks
//
//  Created by Iska on 26/12/14.
//  Copyright (c) 2014 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, RocksDBPrefixType)
{
	RocksDBPrefixFixedLength
};

@interface RocksDBPrefixExtractor : NSObject

+ (instancetype)prefixExtractorWithType:(RocksDBPrefixType)type length:(size_t)length;

- (instancetype)initWithName:(NSString *)name
			  transformBlock:(id (^)(id key))transformBlock
		prefixCandidateBlock:(BOOL (^)(id key))prefixCandidateBlock
			validPrefixBlock:(BOOL (^)(id prefix))validPrefixBlock;

@end

//
//  RocksDBPrefixExtractor.h
//  ObjectiveRocks
//
//  Created by Iska on 26/12/14.
//  Copyright (c) 2014 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 Constants for the built-in prefix extractors.
 */
typedef NS_ENUM(NSUInteger, RocksDBPrefixType)
{
	/** @brief Extract a fixed-length prefix for each key. */
	RocksDBPrefixFixedLength
};

/**
 `RocksDBIterator` supports iterating inside a key-prefix by providing a `RocksDBPrefixExtractor`.

 The `RocksDBPrefixExtractor` defines a Slice-Transform function that is applied to each key when
 itarating the DB in order to extract the prefix for the prefix-seek API.
 */
@interface RocksDBPrefixExtractor : NSObject

/**
 Intializes a new instance of the prefix extarctor with the given type and length.

 @param type The type of the prefix extractor.
 @param length The length of the desired prefix.
 @return A newly-initialized instance of a prefix extractor.
 */
+ (instancetype)prefixExtractorWithType:(RocksDBPrefixType)type length:(size_t)length;

/**
 Intializes a new instance of the prefix extarctor with the given transformation functions.

 @param transformBlock A block to apply to each key to extract the prefix.
 @param prefixCandidateBlock A block that is applied to each key before the transformation
 in order to filter out keys that are not viable candidates for the custom prefix format,
 e.g. key length is smaller than the target prefix length.
 @param validPrefixBlock A block that is applied to each key after the transformation in
 order to perform extra checks to verify that the extracted prefix is valid.
 @return A newly-initialized instance of a prefix extractor.
 */
- (instancetype)initWithName:(NSString *)name
			  transformBlock:(id (^)(id key))transformBlock
		prefixCandidateBlock:(BOOL (^)(id key))prefixCandidateBlock
			validPrefixBlock:(BOOL (^)(id prefix))validPrefixBlock;

@end

Add source code documentation for the Prefix Extractor class


// Test if message passing works
// Should on x86, not on arm
// Basically always just doesn't see the write at all.
// Probably need to loop.

// On ARM:
// mp        - observed
// mp+ctrl   - observed
// mp+addr   - not observed :( was hoping to
// mp+sync+addr - not observed; good!

#include "atomic.h"
#include <stdio.h>
#include <assert.h>

volatile long data PADDED = 1;
volatile long ready PADDED = 0;

volatile long *pdata;

volatile int foo;

int thread0()
{
    // Trying a bunch of things to see if I can get that ready write
    // to happen before the data one, but I haven't managed.
//    extern int go; /* durrrr */
//    data = go * go + 1;
    *pdata = 1;
//    smp_mb();
    ready = 1;
    return 0;
}

int thread1()
{
    int rready;
    while (!(rready = ready));
    ctrl_isync(rready);
    int rdata = data;
    return ((!!rdata)<<1) | rready;
}

void reset()
{
    pdata = &data;
    assert(data != 0);
    ready = 0;
    data = 0;
}

// Formatting results
int result_counts[4];

void process_results(int *r)
{
    int idx = r[1];
    result_counts[idx]++;
}

void summarize_results()
{
    for (int r0 = 0; r0 <= 1; r0++) {
        for (int r1 = 0; r1 <= 1; r1++) {
            int idx = (r1<<1) | r0;
            printf("ready=%d data=%d: %d\n", r0, r1, result_counts[idx]);
        }
    }
    printf("&data = %p, &ready=%p\n", &data, &ready);
}

typedef int (test_fn)();
test_fn *test_fns[] = {thread0, thread1};

int thread_count = 2;

Add an MP test that uses imb instead of deps


#ifndef __IM_WINDOW_MANAGER_DX11_H__
#define __IM_WINDOW_MANAGER_DX11_H__

#include "ImwConfig.h"

#include "ImwWindowManager.h"

namespace ImWindow
{
	class ImwWindowManagerDX11 : public ImwWindowManager
	{
	public:
		ImwWindowManagerDX11();
		virtual							~ImwWindowManagerDX11();
	protected:
		virtual ImwPlatformWindow*		CreatePlatformWindow(bool bMain, ImwPlatformWindow* pParent, bool bDragWindow);

		virtual void					LogFormatted(const char* pStr);

		virtual void					InternalRun();
		virtual ImVec2					GetCursorPos();
		virtual bool					IsLeftClickDown();
	};
}

#endif //__IM_WINDOW_MANAGER_DX11_H__

#ifndef __IM_WINDOW_MANAGER_DX11_H__
#define __IM_WINDOW_MANAGER_DX11_H__

#include "ImwConfig.h"

#include "ImwWindowManager.h"

namespace ImWindow
{
	class ImwWindowManagerDX11 : public ImwWindowManager
	{
	public:
		ImwWindowManagerDX11();
		virtual							~ImwWindowManagerDX11();
	protected:
		virtual bool					CanCreateMultipleWindow() { return true; }
		virtual ImwPlatformWindow*		CreatePlatformWindow(bool bMain, ImwPlatformWindow* pParent, bool bDragWindow);

		virtual void					LogFormatted(const char* pStr);

		virtual void					InternalRun();
		virtual ImVec2					GetCursorPos();
		virtual bool					IsLeftClickDown();
	};
}

#endif //__IM_WINDOW_MANAGER_DX11_H__

Add forgotten function in DX11 implementation


//===-- sancov_flags.h ------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Sanitizer Coverage runtime flags.
//
//===----------------------------------------------------------------------===//
#ifndef SANCOV_FLAGS_H
#define SANCOV_FLAGS_H

#include "sanitizer_flag_parser.h"
#include "sanitizer_internal_defs.h"

namespace __sancov {

struct SancovFlags {
#define SANCOV_FLAG(Type, Name, DefaultValue, Description) Type Name;
#include "sancov_flags.inc"
#undef SANCOV_FLAG

  void SetDefaults();
};

extern SancovFlags sancov_flags_dont_use_directly;

inline SancovFlags* sancov_flags() { return &sancov_flags_dont_use_directly; }

void InitializeSancovFlags();

extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE const char*
__sancov_default_options();

}  // namespace __sancov

#endif

//===-- sancov_flags.h ------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Sanitizer Coverage runtime flags.
//
//===----------------------------------------------------------------------===//
#ifndef SANCOV_FLAGS_H
#define SANCOV_FLAGS_H

#include "sanitizer_flag_parser.h"
#include "sanitizer_internal_defs.h"

namespace __sancov {

struct SancovFlags {
#define SANCOV_FLAG(Type, Name, DefaultValue, Description) Type Name;
#include "sancov_flags.inc"
#undef SANCOV_FLAG

  void SetDefaults();
};

extern SancovFlags sancov_flags_dont_use_directly;

inline SancovFlags* sancov_flags() { return &sancov_flags_dont_use_directly; }

void InitializeSancovFlags();

}  // namespace __sancov

extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE const char*
__sancov_default_options();

#endif

[sancov] Move __sancov_default_options declaration outside the namespace __sancov

After this commint, we can include sancov_flags.h and refer to
__sancov_default_options without requiring the namespace prefix.

Differential Revision: https://reviews.llvm.org/D29167

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


/*
name: TEST022
description: Basic test for int constants
comments: This test is done for z80 data types
output:
F1
G1	F1	main
{
-
A2	I	i
A3	N	u
	A2	#I1	:I
	A2	#IFFFF	:I
	A2	#IFFFF	:I
	A2	#IFFFF	:I
	A2	#IFFFF	:I
	A2	#I3	:I
	A2	#I1	:I
	A2	#I0	:I
	A3	#N1	:N
	A3	#NFFFF	:N
	A3	#NFFFF	:N
	A3	#NFFFF	:N
	A3	#NFFFF	:N
	A3	#N0	:N
	A3	#N3	:N
	A3	#N0	:N
	y	#I0
}
*/

int
main(void)
{
	int i;
	unsigned u;

	i = 1;
	i = -1;
	i = -1l;
	i = -1u;
	i = -1ll;
	i = 32766 + 1 & 3;
	i = (int) 32768 < 0;
	i = -1u < 0;

	u = 1;
	u = -1;
	u = -1l;
	u = -1u;
	u = -1ll;
	u = (unsigned) 32768 < 0;
	u = 32766 + 1 & 3;
	u = -1u < 0;
	return 0;
}

Add basic test for integer constans

Add basic test for integer constans

This test fails at this moment because overflow in constant castings
are not correctly handled.


#ifndef FTDEBOUNCER_LAMBDA_H
#define FTDEBOUNCER_LAMBDA_H

#include "FTDebouncer.h"

//Dummy function implementations to satisfy linker when using lambdas
void onPinActivated(int pinNumber){}
void onPinDeactivated(int pinNumber){}

#endif

Add include guard for lambda header

Add include guard for lambda header


//===--- MacroBuilder.h - CPP Macro building utilitiy -----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the MacroBuilder utility class.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_BASIC_MACROBUILDER_H
#define LLVM_CLANG_BASIC_MACROBUILDER_H

#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"

namespace clang {

class MacroBuilder {
  llvm::raw_ostream &Out;
public:
  MacroBuilder(llvm::raw_ostream &Output) : Out(Output) {}

  /// Append a #define line for macro of the form "#define Name Value\n".
  void defineMacro(const llvm::Twine &Name, const llvm::Twine &Value = "1") {
    Out << "#define " << Name << ' ' << Value << '\n';
  }

  /// Append a #undef line for Name.  Name should be of the form XXX
  /// and we emit "#undef XXX".
  void undefineMacro(const llvm::Twine &Name) {
    Out << "#undef " << Name << '\n';
  }

  /// Directly append Str and a newline to the underlying buffer.
  void append(const llvm::Twine &Str) {
    Out << Str << '\n';
  }
};

}  // end namespace clang

#endif

//===--- MacroBuilder.h - CPP Macro building utility ------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the MacroBuilder utility class.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_BASIC_MACROBUILDER_H
#define LLVM_CLANG_BASIC_MACROBUILDER_H

#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"

namespace clang {

class MacroBuilder {
  llvm::raw_ostream &Out;
public:
  MacroBuilder(llvm::raw_ostream &Output) : Out(Output) {}

  /// Append a #define line for macro of the form "#define Name Value\n".
  void defineMacro(const llvm::Twine &Name, const llvm::Twine &Value = "1") {
    Out << "#define " << Name << ' ' << Value << '\n';
  }

  /// Append a #undef line for Name.  Name should be of the form XXX
  /// and we emit "#undef XXX".
  void undefineMacro(const llvm::Twine &Name) {
    Out << "#undef " << Name << '\n';
  }

  /// Directly append Str and a newline to the underlying buffer.
  void append(const llvm::Twine &Str) {
    Out << Str << '\n';
  }
};

}  // end namespace clang

#endif

Fix a typo pointed about by gabor.

Fix a typo pointed about by gabor.

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


#ifndef __ASM_X86_BITSPERLONG_H
#define __ASM_X86_BITSPERLONG_H

#ifdef __x86_64__
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif

#include <asm-generic/bitsperlong.h>

#endif /* __ASM_X86_BITSPERLONG_H */

#ifndef __ASM_X86_BITSPERLONG_H
#define __ASM_X86_BITSPERLONG_H

#if defined(__x86_64__) && !defined(__ILP32__)
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif

#include <asm-generic/bitsperlong.h>

#endif /* __ASM_X86_BITSPERLONG_H */

x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds

On x32, gcc predefines __x86_64__ but long is only 32-bit.  Use
__ILP32__ to distinguish x32.

Fixes this compiler error in perf:

	tools/include/asm-generic/bitops/__ffs.h: In function '__ffs':
	tools/include/asm-generic/bitops/__ffs.h:19:8: error: right shift count >= width of type [-Werror=shift-count-overflow]
	  word >>= 32;
	       ^

This isn't sufficient to build perf for x32, though.

Signed-off-by: Ben Hutchings <73675debcd8a436be48ec22211dcf44fe0df0a64@decadent.org.uk>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: 2578944098299abf708b08eff6fcf60565553586@vger.kernel.org
Link: 1a33e98b5ba0bc803f6f34527d38fce92e88714d@decadent.org.uk
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>


#include <stdio.h>
void abort(void);

/* This is used by the `assert' macro.  */
void
__eprintf (const char *string, const char *expression,
           unsigned int line, const char *filename)
{
  fprintf (stderr, string, expression, line, filename);
  fflush (stderr);
  abort ();
}

Implement the printf function, used by assert

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


#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
class MenuState :
	public GameState
{
private:
public:
	MenuState();
	~MenuState();

	int ShutDown();
	int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler);
	int Update(float dt, InputHandler * inputHandler);
private:
};

#endif

#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
#include "../GraphicsDLL/GraphicsComponent.h"
class MenuState :
	public GameState
{
private:
	const static int m_NR_OF_MENU_ITEMS = 2;
	UIComponent* m_uiComps[NR_OF_MENU_ITEMS];
	TextComponent* m_textComps[NR_OF_MENU_ITEMS];
public:
	MenuState();
	~MenuState();

	int ShutDown();
	int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler);
	int Update(float dt, InputHandler * inputHandler);
private:
};

#endif

ADD ui and text comps to menustate

ADD ui and text comps to menustate


/*
 * Copyright (c) 2017, Arm Limited and affiliates.
 * SPDX-License-Identifier: Apache-2.0
 *
 * 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 TELIT_HE910_CELLULAR_POWER_H_
#define TELIT_HE910_CELLULAR_POWER_H_

#include "AT_CellularPower.h"

namespace mbed {

class QUECTEL_BC95_CellularPower : public AT_CellularPower
{
public:
    QUECTEL_BC95_CellularPower(ATHandler &atHandler);
    virtual ~QUECTEL_BC95_CellularPower();

public: //from CellularPower
    virtual nsapi_error_t set_at_mode();

    virtual nsapi_error_t reset();
};

} // namespace mbed

#endif // TELIT_HE910_CELLULAR_POWER_H_

/*
 * Copyright (c) 2017, Arm Limited and affiliates.
 * SPDX-License-Identifier: Apache-2.0
 *
 * 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 QUECTEL_BC95_CELLULAR_POWER_H_
#define QUECTEL_BC95_CELLULAR_POWER_H_

#include "AT_CellularPower.h"

namespace mbed {

class QUECTEL_BC95_CellularPower : public AT_CellularPower
{
public:
    QUECTEL_BC95_CellularPower(ATHandler &atHandler);
    virtual ~QUECTEL_BC95_CellularPower();

public: //from CellularPower
    virtual nsapi_error_t set_at_mode();

    virtual nsapi_error_t reset();
};

} // namespace mbed

#endif // QUECTEL_BC95_CELLULAR_POWER_H_

Fix wrong header define name

Fix wrong header define name


#ifndef DSMCC_COMPRESS_H
#define DSMCC_COMPRESS_H

#include <stdbool.h>

#include "dsmcc-config.h"
#include "dsmcc-debug.h"

#ifdef HAVE_ZLIB
bool dsmcc_inflate_file(const char *filename);
#else
static inline bool dsmcc_inflate_file(const char *filename)
{
	DSMCC_ERROR("Compression support is disabled in this build");
	return false;
}
#endif

#endif /* DSMCC_COMPRESS_H */

#ifndef DSMCC_COMPRESS_H
#define DSMCC_COMPRESS_H

#include <stdbool.h>

#include "dsmcc-config.h"
#include "dsmcc-debug.h"

#ifdef HAVE_ZLIB
bool dsmcc_inflate_file(const char *filename);
#else
static inline bool dsmcc_inflate_file(const char *filename)
{
	(void) filename;
	DSMCC_ERROR("Compression support is disabled in this build");
	return false;
}
#endif

#endif /* DSMCC_COMPRESS_H */

Fix compilation error when disabling zlib support


// RUN: %check -e %s

#define always_inline __attribute((always_inline))

always_inline hidden(int);

void always_inline __attribute((noinline)) noinline(void)
{
}

always_inline void print(const char *fmt, ...)
{
}

always_inline void old(a, b)
	int a, b;
{
}

always_inline void addr(int x)
{
	int *p = &x;
	*p = 3;
}

always_inline void write(int x)
{
	x++;
}

always_inline void rec(int depth)
{
	if(depth < 5)
		rec(depth + 1); // CHECK: can't always_inline function: can't see function
}

always_inline int should_inline()
{
	return 3;
}

main()
{
	should_inline(); // CHECK: !/warn|error/

	rec(0); // CHECK: !/warn|error/

	hidden(3); // CHECK: error: can't always_inline function: can't see function
	noinline(); // CHECK: error: can't always_inline noinline function
	print("hi", 3); // CHECK: error: can't always_inline function: variadic function
	print("hi"); // CHECK: error: can't always_inline function: variadic function
	old(3, 1); // CHECK: error: can't always_inline function: unspecified argument count function
	addr(5); // CHECK: error: can't always_inline function: argument written or addressed
	write(2); // CHECK: error: can't always_inline function: argument written or addressed
}

Test inability to inline certain functions


#include    "./p7r_api.h"
#include    "./p7r_root_alloc.h"

static
struct p7r_poolized_meta {
    int startup_channel[2];
} meta_singleton;

static
void p7r_poolized_main_entrance(void *argument) {
    struct p7r_poolized_meta *meta = argument;
    struct p7r_delegation channel_hint;
    for (;;) {
        channel_hint = p7r_delegate(P7R_DELEGATION_READ, meta->startup_channel[0]);
        // XXX currently do nothing - 'tis wrong for fd under LT mode, so we write nothing to startup channel for now
    }
}

int p7r_poolize(struct p7r_config config) {
    if (pipe(meta_singleton.startup_channel) == -1)
        return -1;
    int ret = p7r_init(config);
    if (ret < 0)
        return close(meta_singleton.startup_channel[0]), close(meta_singleton.startup_channel[1]), ret;
    return p7r_poolized_main_entrance(&meta_singleton), 0;
}

#include    "./p7r_api.h"
#include    "./p7r_root_alloc.h"

static
struct p7r_poolized_meta {
    int startup_channel[2];
} meta_singleton;

static
void p7r_poolized_main_entrance(void *argument) {
    struct p7r_poolized_meta *meta = argument;
    struct p7r_delegation channel_hint;
    for (;;) {
        channel_hint = p7r_delegate(P7R_DELEGATION_READ, meta->startup_channel[0]);
        // XXX currently do nothing - 'tis wrong for fd under LT mode, so we write nothing to startup channel for now
    }
}

static
int p7r_poolize(struct p7r_config config) {
    if (pipe(meta_singleton.startup_channel) == -1)
        return -1;
    int ret = p7r_init(config);
    if (ret < 0)
        return close(meta_singleton.startup_channel[0]), close(meta_singleton.startup_channel[1]), ret;
    return p7r_poolized_main_entrance(&meta_singleton), 0;
}

Load balance & foreign message queue refactored.


/* ISC license. */

#include <limits.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <s6-rc/s6rc-utils.h>

int s6rc_livedir_prefixsize (char const *live, size_t *n)
{
  struct stat st ;
  size_t llen = strlen(live) ;
  char sfn[llen + 8] ;
  memcpy(sfn, live, llen) ;
  memcpy(sfn + llen, "/prefix", 8) ;
  if (stat(sfn, &st) < 0)
  {
    if (errno != ENOENT) return 0 ;
    *n = 0 ;
    return 1 ;
  }
  if (!S_ISREG(st.st_mode)) return (errno = EINVAL, 0) ;
  if (st.st_size > NAME_MAX) return (errno = ENAMETOOLONG, 0) ;
  *n = st.st_size ;
  return 1 ;
}

/* ISC license. */

#include <limits.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <s6-rc/s6rc-utils.h>

int s6rc_livedir_prefixsize (char const *live, size_t *n)
{
  struct stat st ;
  size_t llen = strlen(live) ;
  char sfn[llen + 8] ;
  memcpy(sfn, live, llen) ;
  memcpy(sfn + llen, "/prefix", 8) ;
  if (stat(sfn, &st) < 0)
  {
    if (errno != ENOENT) return 0 ;
    *n = 0 ;
    return 1 ;
  }
  if (!S_ISREG(st.st_mode)) return (errno = EINVAL, 0) ;
  if (st.st_size > PATH_MAX) return (errno = ENAMETOOLONG, 0) ;
  *n = st.st_size ;
  return 1 ;
}

Change safety guard to PATH_MAX because Solaris doesn't know NAME_MAX


Fix overflow in test case

Fix overflow in test case


#ifndef POINTS_DOWNSAMPLER_H
#define POINTS_DOWNSAMPLER_H

static pcl::PointCloud<pcl::PointXYZI> removePointsByRange(pcl::PointCloud<pcl::PointXYZI> scan, double min_range, double max_range)
{
  pcl::PointCloud<pcl::PointXYZI> narrowed_scan;
  narrowed_scan.header = scan.header;
  double square_min_range = min_range * min_range;
  double square_max_range = max_range * max_range;

  for(pcl::PointCloud<pcl::PointXYZI>::const_iterator iter = scan.begin(); iter != scan.end(); ++iter)
  {
    const pcl::PointXYZI &p = *iter;
//    p.x = iter->x;
//    p.y = iter->y;
//    p.z = iter->z;
//    p.intensity = iter->intensity;
    double square_distance = p.x * p.x + p.y * p.y;

    if(square_min_range <= square_distance && square_distance <= square_max_range){
      narrowed_scan.points.push_back(p);
    }
  }
#if 1
  return narrowed_scan;
#else
  return scan;    //  This is a only tempolary patch for Localization problem.
#endif
}

#endif // POINTS_DOWNSAMPLER_H

#ifndef POINTS_DOWNSAMPLER_H
#define POINTS_DOWNSAMPLER_H

static pcl::PointCloud<pcl::PointXYZI> removePointsByRange(pcl::PointCloud<pcl::PointXYZI> scan, double min_range, double max_range)
{
  pcl::PointCloud<pcl::PointXYZI> narrowed_scan;
  narrowed_scan.header = scan.header;

#if 1     //  This error handling should be detemind.
  if( min_range>=max_range ) {
    ROS_ERROR_ONCE("min_range>=max_range @(%lf, %lf)", min_range, max_range );
    return scan;
  }
#endif

  double square_min_range = min_range * min_range;
  double square_max_range = max_range * max_range;

  for(pcl::PointCloud<pcl::PointXYZI>::const_iterator iter = scan.begin(); iter != scan.end(); ++iter)
  {
    const pcl::PointXYZI &p = *iter;
//    p.x = iter->x;
//    p.y = iter->y;
//    p.z = iter->z;
//    p.intensity = iter->intensity;
    double square_distance = p.x * p.x + p.y * p.y;

    if(square_min_range <= square_distance && square_distance <= square_max_range){
      narrowed_scan.points.push_back(p);
    }
  }

  return narrowed_scan;
}

#endif // POINTS_DOWNSAMPLER_H

Add Error handring to removePointsByRange()


/**
 * Copyright (c) 2014, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the "hack" directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 */
#define CAML_NAME_SPACE
#include <caml/memory.h>
#include <caml/alloc.h>
#include <string.h>

#include "hphp/util/embedded-data.h"

#define BUF_SIZE 64

static const char section_name[] = "build_id";
static const char default_id[] = "hackc-unknown-version";

value hh_get_compiler_id(void) {
  CAMLparam0();
  char buf[BUF_SIZE];
  ssize_t len = hphp_read_embedded_data(section_name, buf, BUF_SIZE);
  value result;

  if (len < 0) {
    result = caml_alloc_string(strlen(default_id));
    memcpy(String_val(result), default_id, strlen(default_id));
    CAMLreturn(result);
  } else {
    result = caml_alloc_string(len);
    memcpy(String_val(result), buf, len);
    CAMLreturn(result);
  }
}

/**
 * Copyright (c) 2014, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the "hack" directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 */
#define CAML_NAME_SPACE
#include <caml/memory.h>
#include <caml/alloc.h>
#include <string.h>

#include "hphp/util/embedded-data.h"

#define BUF_SIZE 64

static const char section_name[] = "build_id";
static const char default_id[] = "hackc-unknown-version";

#define STRINGIFY_HELPER(x) #x
#define STRINGIFY_VALUE(x) STRINGIFY_HELPER(x)

value hh_get_compiler_id(void) {
  CAMLparam0();
#ifdef HACKC_COMPILER_ID
  const char buf[] = STRINGIFY_VALUE(HACKC_COMPILER_ID);
  const ssize_t len = sizeof(buf) - 1;
#else
  char buf[BUF_SIZE];
  const ssize_t len = hphp_read_embedded_data(section_name, buf, BUF_SIZE);
#endif
  value result;

  if (len < 0) {
    result = caml_alloc_string(strlen(default_id));
    memcpy(String_val(result), default_id, strlen(default_id));
    CAMLreturn(result);
  } else {
    result = caml_alloc_string(len);
    memcpy(String_val(result), buf, len);
    CAMLreturn(result);
  }
}

[hack] Allow specifyign hackc compiler id with C define

Summary:
OSS friendliness:
 - on mac, we *can't* add an ELF section after the fact, we must have it when building
 - script is fb-specific for now (though doens't need to be)

Depends on D6237249

Reviewed By: paulbiss

Differential Revision: D6238694

fbshipit-source-id: 9b07cadb68c7d34e05bdb7094ee23bcf35ae6f4b


/** Author : Paul TREHIOU & Victor SENE
 *  Date : November 2014
 **/

/**
 * Declaration Point structure
 * x - real wich is the abscisse of the point
 * y - real wich is the ordinate of the point
 */
typedef struct
{
	float x;
 	float y;
}Point;

/**
 * Function wich create a point with a specified abscisse and ordinate
 * abscisse - real
 * ordinate - real
 * return a new point
 */
Point createPoint(float abscisse, float ordinate);

/**
 * Declaration of the Element structure
 * value - value of the point of the current element of the polygon
 * next - pointer on the next element
 * previous - pointer on the previous element
 */
typedef struct pointelem{

	Point value;
	pointelem* next;
	pointelem* previous;

}PointElement;

/**
 * Declaration of the Polygon
 */
typedef PointElement* Polygon;

/** Author : Paul TREHIOU & Victor SENE
 *  Date : November 2014
 **/

/**
 * Declaration Point structure
 * x - real wich is the abscisse of the point
 * y - real wich is the ordinate of the point
 */
typedef struct
{
	float x;
 	float y;
}Point;

/**
 * Declaration of the Element structure
 * value - value of the point of the current element of the polygon
 * next - pointer on the next element
 * previous - pointer on the previous element
 */
typedef struct pointelem{

	Point value;
	pointelem* next;
	pointelem* previous;

}PointElement;

/**
 * Declaration of the Polygon
 */
typedef PointElement* Polygon;

/**
 * Function wich create a point with a specified abscisse and ordinate
 * abscisse - real
 * ordinate - real
 * return a new point
 */
Point createPoint(float abscisse, float ordinate);

Move the structure definition on a better place


#ifndef OPTIONFIELDPAIRS_H
#define OPTIONFIELDPAIRS_H

#include "optioni.h"

typedef std::pair<std::string, std::string> FieldPair;
typedef std::vector<FieldPair> FieldPairs;

class OptionFieldPairs : public OptionI<std::vector<std::pair<std::string, std::string> > >
{
public:
	OptionFieldPairs(std::string name);

	virtual Json::Value asJSON() const override;
	virtual void set(Json::Value &value) override;
};

#endif // OPTIONFIELDPAIRS_H

#ifndef OPTIONFIELDPAIRS_H
#define OPTIONFIELDPAIRS_H

#include "optioni.h"
#include "common.h"

typedef std::pair<std::string, std::string> FieldPair;
typedef std::vector<FieldPair> FieldPairs;

class OptionFieldPairs : public OptionI<std::vector<std::pair<std::string, std::string> > >
{
public:
	OptionFieldPairs(std::string name);

    virtual Json::Value asJSON() const OVERRIDE;
    virtual void set(Json::Value &value) OVERRIDE;
};

#endif // OPTIONFIELDPAIRS_H

Fix for GCC 4.6 compatibility

Fix for GCC 4.6 compatibility


#include "opt.h"

CorkOpt *
corkopt_init(int argc, char *argv[])
{
    CorkOpt *co;

    if ((co = malloc(sizeof(CorkOpt))) == NULL)
        return NULL;

    co->argc = argc;
    co->argv = argv;

    return co;
}

static void
corkopt_fini(CorkOpt *co)
{ }

void
corkopt_add(CorkOpt *co,
            int shortopt,
            const char *longopt,
            const char *helptext,
            const int flags)
{
    CorkOptElement *coe;

    if ((coe = malloc(sizeof(CorkOptElement))) == NULL)
        return;

    coe->short_opt = shortopt;
    coe->long_opt  = longopt;
    coe->help_text = helptext;
    coe->flags     = flags;

    corklist_append(co->opts, coe);
    return;
}

#include "opt.h"

CorkOpt *
corkopt_init(void)
{
    CorkOpt *co;

    if ((co = malloc(sizeof(CorkOpt))) == NULL)
        return NULL;

    co->args = corklist_create();
    return co;
}

void
corkopt_fini(CorkOpt *co)
{ }

void
corkopt_add(CorkOpt *co,
            int shortopt,
            const char *longopt,
            const char *helptext,
            const int flags)
{
    CorkOptElement *coe;

    if ((coe = malloc(sizeof(CorkOptElement))) == NULL)
        return;

    coe->short_opt = shortopt;
    coe->long_opt  = longopt;
    coe->help_text = helptext;
    coe->flags     = flags;

    corklist_append(co->opts, coe);
    return;
}

Change some function prototypes around

Change some function prototypes around


#ifdef __CINT__

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

#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit;
#pragma link C++ class TSTLhitList;
#pragma link C++ class TSTLhitDeque;
#pragma link C++ class TSTLhitSet;
#pragma link C++ class TSTLhitMultiset;
#pragma link C++ class TSTLhitMap;
#pragma link C++ class TSTLhitMultiMap;
//#pragma link C++ class TSTLhitHashSet;
//#pragma link C++ class TSTLhitHashMultiset;
#pragma link C++ class pair<int,THit>;

#pragma link C++ class TSTLhitStar;
#pragma link C++ class TSTLhitStarList;
#pragma link C++ class TSTLhitStarDeque;
#pragma link C++ class TSTLhitStarSet;
#pragma link C++ class TSTLhitStarMultiSet;
#pragma link C++ class TSTLhitStarMap;
#pragma link C++ class TSTLhitStarMultiMap;
#pragma link C++ class pair<int,THit*>;

#pragma link C++ class TCloneshit+;

#endif

#ifdef __CINT__

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

#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit+;
#pragma link C++ class TSTLhitList+;
#pragma link C++ class TSTLhitDeque+;
#pragma link C++ class TSTLhitSet+;
#pragma link C++ class TSTLhitMultiset+;
#pragma link C++ class TSTLhitMap+;
#pragma link C++ class TSTLhitMultiMap+;
//#pragma link C++ class TSTLhitHashSet;
//#pragma link C++ class TSTLhitHashMultiset;
#pragma link C++ class pair<int,THit>+;

#pragma link C++ class TSTLhitStar+;
#pragma link C++ class TSTLhitStarList+;
#pragma link C++ class TSTLhitStarDeque+;
#pragma link C++ class TSTLhitStarSet+;
#pragma link C++ class TSTLhitStarMultiSet+;
#pragma link C++ class TSTLhitStarMap+;
#pragma link C++ class TSTLhitStarMultiMap+;
#pragma link C++ class pair<int,THit*>+;

#pragma link C++ class TCloneshit+;

#endif

Use the option "+" to force the new style Streamer for all classes in bench.

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


// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
// XFAIL: -linux-
// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
typedef int a;

// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
// XFAIL: -linux-, -freebsd
// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
typedef int a;

Fix an XRay test on FreeBSD

[test] Fix an XRay test on FreeBSD

Summary: Fixing clang-test on FreeBSD as a follow-up of https://reviews.llvm.org/D43378 to handle the revert happened in r325749.

Reviewers: devnexen, krytarowski, dberris

Subscribers: emaste, dberris, cfe-commits

Differential Revision: https://reviews.llvm.org/D45002

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


// vim:cindent:cino=\:0:et:fenc=utf-8:ff=unix:sw=4:ts=4:

#ifndef CONVEYOR_JOB_H
#define CONVEYOR_JOB_H (1)

#include <QList>
#include <QObject>
#include <QScopedPointer>
#include <QString>

#include <conveyor/fwd.h>
#include <conveyor/jobstatus.h>

namespace conveyor
{
    class Job : public QObject
    {
        Q_OBJECT

    public:
        ~Job (void);

        int id (void) const;
        QString name (void) const;
        JobState state (void) const;
        JobConclusion conclusion (void) const;

        int currentStepProgress (void) const;
        QString currentStepName (void) const;

        void cancel (void);
        void pause (void);

    signals:
        void changed (const Job *);

    private:
        Job (Conveyor * conveyor, int const & id);

        QScopedPointer <JobPrivate> m_private;

        void emitChanged (void);

        friend class Conveyor;
        friend class ConveyorPrivate;
        friend class JobAddedMethod;
        friend class JobChangedMethod;
        friend class JobPrivate;
        friend class Printer;
        friend class PrinterPrivate;
    };
}

#endif

// vim:cindent:cino=\:0:et:fenc=utf-8:ff=unix:sw=4:ts=4:

#ifndef CONVEYOR_JOB_H
#define CONVEYOR_JOB_H (1)

#include <QList>
#include <QObject>
#include <QScopedPointer>
#include <QString>

#include <conveyor/fwd.h>
#include <conveyor/jobstatus.h>

namespace conveyor
{
    class Job : public QObject
    {
        Q_OBJECT

    public:
        ~Job (void);

        int id (void) const;
        QString name (void) const;
        JobState state (void) const;
        JobConclusion conclusion (void) const;

        int currentStepProgress (void) const;
        QString currentStepName (void) const;

    public slots:
        void cancel (void);
        void pause (void);

    signals:
        void changed (const Job *);

    private:
        Job (Conveyor * conveyor, int const & id);

        QScopedPointer <JobPrivate> m_private;

        void emitChanged (void);

        friend class Conveyor;
        friend class ConveyorPrivate;
        friend class JobAddedMethod;
        friend class JobChangedMethod;
        friend class JobPrivate;
        friend class Printer;
        friend class PrinterPrivate;
    };
}

#endif

Make Job::cancel and Job::pause public slots


//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author:  Axel Naumann <axel@cern.ch>
//------------------------------------------------------------------------------

#ifndef CLING_COMPILATIONEXCEPTION_H
#define CLING_COMPILATIONEXCEPTION_H

#include <stdexcept>
#include <string>
#include "cling/Interpreter/RuntimeException.h"

namespace cling {
  class Interpreter;
  class MetaProcessor;

  //\brief Exception pull us out of JIT (llvm + clang) errors.
  class CompilationException:
    public virtual runtime::InterpreterException,
    public virtual std::runtime_error {
  public:
    CompilationException(const std::string& reason):
      std::runtime_error(reason) {}
    ~CompilationException() throw(); // vtable pinned to UserInterface.cpp
    virtual const char* what() const throw() {
      return std::runtime_error::what(); }
  };
}

#endif // CLING_COMPILATIONEXCEPTION_H

//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author:  Axel Naumann <axel@cern.ch>
//------------------------------------------------------------------------------

#ifndef CLING_COMPILATIONEXCEPTION_H
#define CLING_COMPILATIONEXCEPTION_H

#include <stdexcept>
#include <string>
#include "cling/Interpreter/RuntimeException.h"

namespace cling {
  class Interpreter;
  class MetaProcessor;

  ///\brief Exception that pulls cling out of runtime-compilation (llvm + clang)
  ///       errors.
  ///
  /// If user code provokes an llvm::unreachable it will cause this exception
  /// to be thrown. Given that this is at the process's runtime and an
  /// interpreter error it inherits from InterpreterException and runtime_error.
  /// Note that this exception is *not* thrown during the execution of the
  /// user's code but during its compilation (at runtime).
  class CompilationException:
    public virtual runtime::InterpreterException,
    public virtual std::runtime_error {
  public:
    CompilationException(const std::string& reason):
      std::runtime_error(reason) {}
    ~CompilationException() throw(); // vtable pinned to UserInterface.cpp
    virtual const char* what() const throw() {
      return std::runtime_error::what(); }
  };
}

#endif // CLING_COMPILATIONEXCEPTION_H

Add more rationale as to how this exception is different from others.


// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -o -
#define __MM_MALLOC_H

#include <x86intrin.h>

// No warnings.
extern __m256i a;
int __attribute__((target("avx"))) bar(__m256i a) {
  return _mm256_extract_epi32(a, 3);
}

int baz() {
  return bar(a);
}

int __attribute__((target("avx"))) qq_avx(__m256i a) {
  return _mm256_extract_epi32(a, 3);
}

int qq_noavx() {
  return 0;
}

extern __m256i a;
int qq() {
  if (__builtin_cpu_supports("avx"))
    return qq_avx(a);
  else
    return qq_noavx();
}

Mark this test as requiring and x86 registered target.

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


/*-------------------------------------------------------------------------
 *
 * arch-arm.h
 *	  Atomic operations considerations specific to ARM
 *
 * Portions Copyright (c) 2013-2017, PostgreSQL Global Development Group
 *
 * NOTES:
 *
 * src/include/port/atomics/arch-arm.h
 *
 *-------------------------------------------------------------------------
 */

/* intentionally no include guards, should only be included by atomics.h */
#ifndef INSIDE_ATOMICS_H
#error "should be included via atomics.h"
#endif

/*
 * 64 bit atomics on arm are implemented using kernel fallbacks and might be
 * slow, so disable entirely for now.
 * XXX: We might want to change that at some point for AARCH64
 */
#define PG_DISABLE_64_BIT_ATOMICS

/*-------------------------------------------------------------------------
 *
 * arch-arm.h
 *	  Atomic operations considerations specific to ARM
 *
 * Portions Copyright (c) 2013-2017, PostgreSQL Global Development Group
 *
 * NOTES:
 *
 * src/include/port/atomics/arch-arm.h
 *
 *-------------------------------------------------------------------------
 */

/* intentionally no include guards, should only be included by atomics.h */
#ifndef INSIDE_ATOMICS_H
#error "should be included via atomics.h"
#endif

/*
 * 64 bit atomics on ARM32 are implemented using kernel fallbacks and thus
 * might be slow, so disable entirely. On ARM64 that problem doesn't exist.
 */
#if !defined(__aarch64__) && !defined(__aarch64)
#define PG_DISABLE_64_BIT_ATOMICS
#endif  /* __aarch64__ || __aarch64 */

Enable 64 bit atomics on ARM64.

Enable 64 bit atomics on ARM64.

Previously they were disabled due to performance concerns on 32bit
arm, where 64bit atomics are often implemented via kernel traps.

Author: Roman Shaposhnik
Discussion: 3cd39cbacb0d69a21809879b1660e5325a970d65@mail.gmail.com


#include "unity.h"
#include "unity_fixture.h"
#include "Utils/IO/ArrayIO.h"
#include "Utils/IO/BlockMapIO.h"
#include "Utils/IO/ImageIO.h"
#include "Utils/IO/HistogramIO.h"

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

bool IsUnderCI = false ;

TEST_GROUP(DataStructures);

TEST_SETUP(DataStructures)
{
    IsUnderCI = (getenv("CI") != NULL);
}

TEST_TEAR_DOWN(DataStructures)
{
}

TEST(DataStructures, BlockMap_SanityCheck)
{
    BlockMap blockMap = BlockMapIO_ConstructFromFile("DataStructures/101_1.tif.12.Equalize.blocks.dat");
    if (!IsUnderCI)
    {
        BlockMapIO_Printf(&blockMap);
    }
}

TEST(DataStructures, Image_SanityCheck)
{
    UInt8Array2D image = ImageIO_ConstructFromFile("DataStructures/101_1.tif.12.Equalize.image.dat");
    if (!IsUnderCI)
    {
        ImageIO_Printf(&image);
    }
}

TEST(DataStructures, Histogram_SanityCheck)
{
    Int16Array3D histogram = HistogramIO_ConstructFromFile("DataStructures/101_1.tif.12.Equalize.histgram.dat");
    if (!IsUnderCI)
    {
        HistogramIO_Printf(&histogram);
    }
}

Rename and don't spit out all the sanity output when running on the CI server.


#ifndef QTIPCSERVER_H
#define QTIPCSERVER_H

// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "BitcoinURI"

void ipcScanRelay(int argc, char *argv[]);
void ipcInit(int argc, char *argv[]);

#endif // QTIPCSERVER_H

#ifndef QTIPCSERVER_H
#define QTIPCSERVER_H

// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "CrainCoinURI"

void ipcScanRelay(int argc, char *argv[]);
void ipcInit(int argc, char *argv[]);

#endif // QTIPCSERVER_H

Set correct name for boost IPC

Set correct name for boost IPC


/* libunwind - a platform-independent unwind library
   Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>

This file is part of libunwind.

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

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

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

#include "unwind_i.h"

HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1;

HIDDEN void
tdep_init (void)
{
  intrmask_t saved_mask;

  sigfillset (&unwi_full_mask);

  sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask);
  mutex_lock (&hppa_lock);
  {
    if (!tdep_needs_initialization)
      /* another thread else beat us to it... */
      goto out;

    mi_init ();

    dwarf_init ();

#ifndef UNW_REMOTE_ONLY
    hppa_local_addr_space_init ();
#endif
    tdep_needs_initialization = 0;	/* signal that we're initialized... */
  }
 out:
  mutex_unlock (&hppa_lock);
  sigprocmask (SIG_SETMASK, &saved_mask, NULL);
}

Adjust for sigset_t to intrmask_t renaming.

2004/12/02 00:40:45-08:00 mostang.com!davidm
Add copyright notice.
Provide canonical DWARF-based implementation.

2004/11/30 23:38:42-08:00 mostang.com!davidm
Rename: src/hppa/global.c -> src/hppa/Gglobal.c

(Logical change 1.290)


#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;

BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));

#endif

#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;

BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Preorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Postorder_Tree_Walk(BST* T, void (f)(void*));

#endif

Add BST Pre/Post order walk function declaration


// Copyright 2014-2016 the project authors as listed in the AUTHORS file.
// All rights reserved. Use of this source code is governed by the
// license that can be found in the LICENSE file.

#ifndef _MESSAGE_QUEUE
#define _MESSAGE_QUEUE

// note that on the arduino we have to be careful of how much memory we
// use so the depth of the message queue needs to be kept small
#define MAX_MESSAGES 8
#define MAX_MESSAGE_TEXT_LENGTH 32

typedef struct Message {
  void* device;
  int type;
  long timestamp;
  unsigned long code;
  float value;
  char text[MAX_MESSAGE_TEXT_LENGTH];
  Message* next;
} Message;

class MessageQueue {
  private:
    Message messages[MAX_MESSAGES];
    Message* newMessages;
    Message* freeMessages;

  public:
    MessageQueue(void);
    Message* getFreeMessage(void);
    void enqueueMessage(Message* message);
    Message* dequeueMessages(void);
    void returnMessages(Message* messages, Message* lastMessage);
};

#endif

// Copyright 2014-2016 the project authors as listed in the AUTHORS file.
// All rights reserved. Use of this source code is governed by the
// license that can be found in the LICENSE file.

#ifndef _MESSAGE_QUEUE
#define _MESSAGE_QUEUE

// note that on the arduino we have to be careful of how much memory we
// use so the depth of the message queue needs to be kept small
#define MAX_MESSAGES 8
#define MAX_MESSAGE_TEXT_LENGTH 64

typedef struct Message {
  void* device;
  int type;
  long timestamp;
  unsigned long code;
  float value;
  char text[MAX_MESSAGE_TEXT_LENGTH];
  Message* next;
} Message;

class MessageQueue {
  private:
    Message messages[MAX_MESSAGES];
    Message* newMessages;
    Message* freeMessages;

  public:
    MessageQueue(void);
    Message* getFreeMessage(void);
    void enqueueMessage(Message* message);
    Message* dequeueMessages(void);
    void returnMessages(Message* messages, Message* lastMessage);
};

#endif

Extend size of text in Message

Extend size of text in Message

Was seeeing intermittent failures due to memmory corruption
due to exceeding the message size.


#ifndef BANDIT_DEFAULT_FAILURE_FORMATTER_H
#define BANDIT_DEFAULT_FAILURE_FORMATTER_H

namespace bandit { namespace detail {

  struct default_failure_formatter : public failure_formatter
  {
    std::string format(const assertion_exception& err) const
    {
      std::stringstream ss;
      if(err.file_name().size())
      {
        ss << err.file_name();

        if(err.line_number())
        {
          ss << ":" << err.line_number();
        }

        ss << ": ";
      }

      ss << err.what();

      return ss.str();
    }
  };
}}

#endif

#ifndef BANDIT_DEFAULT_FAILURE_FORMATTER_H
#define BANDIT_DEFAULT_FAILURE_FORMATTER_H

namespace bandit { namespace detail {

  struct default_failure_formatter : public failure_formatter
  {
    std::string format(const assertion_exception& err) const
    {
      std::stringstream ss;
      if(err.file_name().size())
      {
        ss << err.file_name();

        if(err.line_number())
        {
          ss << ":" << err.line_number();
        }

        ss << ": ";
      }

      ss << std::endl << err.what();

      return ss.str();
    }
  };
}}

#endif

Add line break in default error formatter


#ifdef __cplusplus
extern "C" {
#endif

/*
 * buf: input fuzzing data
 * len: size of the 'buf' data
 *
 * Return value: should return 0
 */
    int LLVMFuzzerTestOneInput(const uint8_t * buf, size_t len);

/*
 * argc: ptr to main's argc
 * argv: ptr to main's argv
 *
 * Return value: ignored
 */
    int LLVMFuzzerInitialize(int *argc, char ***argv);

/*
 *
 * An alternative for LLVMFuzzerTestOneInput()
 *
 * buf_ptr: will be set to input fuzzing data
 * len_ptr: will be set to the size of the input fuzzing data
 */
    void HF_ITER(const uint8_t ** buf_ptr, size_t * len_ptr);

#if defined(_HF_ARCH_LINUX)

/*
 * Enter Linux namespaces
 *
 * cloneFlags: see 'man unshare'
 */
    bool linuxEnterNs(uintptr_t cloneFlags);
/*
 * Bring network interface up
 *
 * ifacename: name of the interface, typically "lo"
 */
    bool linuxIfaceUp(const char *ifacename);
/*
 * Mount tmpfs over a mount point
 *
 * dst: mount point for tmfs
 */
    bool linuxMountTmpfs(const char *dst);

#endif                          /* defined(_HF_ARCH_LINUX) */

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

#ifdef __cplusplus
extern "C" {
#endif

/*
 * buf: input fuzzing data
 * len: size of the 'buf' data
 *
 * Return value: should return 0
 */
    int LLVMFuzzerTestOneInput(const uint8_t * buf, size_t len);

/*
 * argc: ptr to main's argc
 * argv: ptr to main's argv
 *
 * Return value: ignored
 */
    int LLVMFuzzerInitialize(int *argc, char ***argv);

/*
 *
 * An alternative for LLVMFuzzerTestOneInput()
 *
 * buf_ptr: will be set to input fuzzing data
 * len_ptr: will be set to the size of the input fuzzing data
 */
    void HF_ITER(const uint8_t ** buf_ptr, size_t * len_ptr);

#if defined(__linux__)

/*
 * Enter Linux namespaces
 *
 * cloneFlags: see 'man unshare'
 */
    bool linuxEnterNs(uintptr_t cloneFlags);
/*
 * Bring network interface up
 *
 * ifacename: name of the interface, typically "lo"
 */
    bool linuxIfaceUp(const char *ifacename);
/*
 * Mount tmpfs over a mount point
 *
 * dst: mount point for tmfs
 */
    bool linuxMountTmpfs(const char *dst);

#endif                          /* defined(__linux__) */

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

Change defined(_HF_ARCH_LINUX) -> defined(__linux__) for public includes


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

coroutine void f(int index)
{
  printf("Worker %d\n", index);
}

int main(int argc, char **argv)
{
  for(int i=1;i<=10; i++) {
    go(f(i));
  }
  return 0;
}

# include <stdio.h>
# include <libmill.h>

coroutine void f(int index)
{
  printf("Worker %d\n", index);
}

int main(int argc, char **argv)
{
  for(int i=1;i<=10; i++) {
    go(f(i));
  }
  return 0;
}

Remove extraneous string.h from listing 1


Use \177 instead of a special character inserted with a hex editor


// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s

void __llvm_profile_reset_counters(void);
void foo(int);
int main(void) {
  foo(0);
  __llvm_profile_reset_counters();
  foo(1);
  return 0;
}
void foo(int N) {
  // CHECK-LABEL: define{{(dso_local)?}} void @foo(
  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[FOO:[0-9]+]]
  if (N) {}
}
// CHECK: ![[FOO]] = !{!"branch_weights", i32 2, i32 1}

// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s

void __llvm_profile_reset_counters(void);
void foo(int);
int main(void) {
  foo(0);
  __llvm_profile_reset_counters();
  foo(1);
  return 0;
}
void foo(int N) {
  // CHECK-LABEL: define{{( dso_local)?}} void @foo(
  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[FOO:[0-9]+]]
  if (N) {}
}
// CHECK: ![[FOO]] = !{!"branch_weights", i32 2, i32 1}

Add space inside the regular expression.

This should now pass on both ppc and x86. Sorry about the noise.

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


#pragma once

#include <pebble.h>

#ifndef PBL_PLATFORM_BASALT

typedef struct StatusBarLayer StatusBarLayer;
struct StatusBarLayer;

static inline StatusBarLayer *status_bar_layer_create(void) {
  return NULL;
}

static inline void status_bar_layer_destroy(StatusBarLayer *status_bar_layer) {
}

static inline Layer *status_bar_layer_get_layer(StatusBarLayer *status_bar_layer) {
  return (Layer *)status_bar_layer;
}

static inline void status_bar_layer_add_to_window(Window *window, StatusBarLayer *status_bar_layer) {
  window_set_fullscreen(window, false);
}

static inline void status_bar_layer_remove_from_window(Window *window, StatusBarLayer *status_bar_layer) {
  window_set_fullscreen(window, true);
}

#else

static inline void status_bar_layer_add_to_window(Window *window, StatusBarLayer *status_bar_layer) {
  layer_add_child(window_get_root_layer(window), status_bar_layer_get_layer(status_bar_layer));
}

static inline void status_bar_layer_remove_from_window(Window *window, StatusBarLayer *status_bar_layer) {
  layer_remove_from_parent(status_bar_layer_get_layer(status_bar_layer));
}

#endif

Add util status bar layer

Add util status bar layer


#ifndef IV_LV5_RADIO_BLOCK_SIZE_H_
#define IV_LV5_RADIO_BLOCK_SIZE_H_
#include <iv/static_assert.h>
#include <iv/arith.h>
namespace iv {
namespace lv5 {
namespace radio {

class Block;

static const std::size_t kBlockSize = core::Size::KB * 4;
static const uintptr_t kBlockMask = ~static_cast<uintptr_t>(kBlockSize - 1);

// must be 2^n size
IV_STATIC_ASSERT((1 << core::math::detail::CTZ<kBlockSize>::value) == kBlockSize);

} } }  // namespace iv::lv5::radio
#endif  // IV_LV5_RADIO_BLOCK_SIZE_H_

#ifndef IV_LV5_RADIO_BLOCK_SIZE_H_
#define IV_LV5_RADIO_BLOCK_SIZE_H_
#include <iv/static_assert.h>
namespace iv {
namespace lv5 {
namespace radio {
namespace detail_block_size {

template<std::size_t x>
struct Is2Power {
  static const bool value = x > 1 && (x & (x - 1)) == 0;
};

}  // namespace detail_block_size

class Block;

static const std::size_t kBlockSize = core::Size::KB * 4;
static const uintptr_t kBlockMask = ~static_cast<uintptr_t>(kBlockSize - 1);

// must be 2^n size
IV_STATIC_ASSERT(detail_block_size::Is2Power<kBlockSize>::value);

} } }  // namespace iv::lv5::radio
#endif  // IV_LV5_RADIO_BLOCK_SIZE_H_

Use Is2Power instead of ctz

Use Is2Power instead of ctz


#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

ErrorCode getErrorCodeForCurlError(int curlCode); //int so we don't have to include curl.h

class Error {
public:
    Error()
        : code{ErrorCode::OK}, message{""} {}

    template <typename ErrorCodeType, typename TextType>
    Error(ErrorCode& p_error_code, TextType&& p_error_message)
        : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    ErrorCode code;
    std::string message;

    //allow easy checking of errors with:
    //   if(error) { do something; }
    explicit operator bool() const {
        return code != ErrorCode::OK;
    }
};

} // namespace cpr

#endif

#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

ErrorCode getErrorCodeForCurlError(int curl_code); //int so we don't have to include curl.h

class Error {
public:
    Error()
        : code{ErrorCode::OK}, message{""} {}

    template <typename ErrorCodeType, typename TextType>
    Error(ErrorCode& p_error_code, TextType&& p_error_message)
        : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    ErrorCode code;
    std::string message;

    //allow easy checking of errors with:
    //   if(error) { do something; }
    explicit operator bool() const {
        return code != ErrorCode::OK;
    }
};

} // namespace cpr

#endif

Use lowercase underscore for variable name


#include <stddef.h>
#include <stdint.h>
#include "gdt.c"
#include "idt.c"
#include "isr.c"
#include "terminal.h"

/* Check if the compiler thinks if we are targeting the wrong operating system. */
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif

/* This tutorial will only work for the 32-bit ix86 targets. */
#if !defined(__i386__)
#error "This tutorial needs to be compiled with a ix86-elf compiler"
#endif

void kernel_main()
{
	gdt_install();
	idt_install();
	isrs_install();
	term_initialize();
	term_writestring("Interrupt?\n");
	int i = 5;
	i = i / 0;
	term_writestring("Hello, Kernel!");
}

#include <stddef.h>
#include <stdint.h>
#include "gdt.h"
#include "idt.h"
#include "isr.h"
#include "terminal.h"

/* Check if the compiler thinks if we are targeting the wrong operating system. */
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif

/* This tutorial will only work for the 32-bit ix86 targets. */
#if !defined(__i386__)
#error "This tutorial needs to be compiled with a ix86-elf compiler"
#endif

void kernel_main()
{
	gdt_install();
	idt_install();
	isrs_install();
	term_initialize();
	term_writestring("Interrupt?\n");
	int i = 5;
	i = i / 0;
	term_writestring("Hello, Kernel!");
}

Change c files to header files.

Change c files to header files.


// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clzero  -emit-llvm -o - -Wall -Werror | FileCheck %s
#define __MM_MALLOC_H

#include <x86intrin.h>
void test_mm_clzero(void * __m) {
  //CHECK-LABEL: @test_mm_clzero
  //CHECK: @llvm.x86.clflushopt
  _mm_clzero(__m);
}

// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clzero  -emit-llvm -o - -Wall -Werror | FileCheck %s
#define __MM_MALLOC_H

#include <x86intrin.h>
void test_mm_clzero(void * __m) {
  //CHECK-LABEL: @test_mm_clzero
  //CHECK: @llvm.x86.clzero
  _mm_clzero(__m);
}

[X86] Fix copy and paste bug in clzero test from r294559.

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


#ifndef PHP_FE_END
# define PHP_FE_END { NULL, NULL, NULL }
#endif

#ifndef HASH_KEY_NON_EXISTENT
# define HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT
#endif

Isolate all PHP compatability stuff into its own file


//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author:  Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------

#ifndef CLING_DISPLAY_H
#define CLING_DISPLAY_H

#include <string>

namespace llvm {
  class raw_ostream;
}

namespace cling {

void DisplayClasses(llvm::raw_ostream &stream,
                    const class Interpreter *interpreter, bool verbose);
void DisplayClass(llvm::raw_ostream &stream,
                  const Interpreter *interpreter, const char *className,
                  bool verbose);

void DisplayGlobals(llvm::raw_ostream &stream, const Interpreter *interpreter);
void DisplayGlobal(llvm::raw_ostream &stream, const Interpreter *interpreter,
                   const std::string &name);

}

#endif

//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author:  Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------

#ifndef CLING_DISPLAY_H
#define CLING_DISPLAY_H

#include <string>

namespace llvm {
  class raw_ostream;
}

namespace cling {
class Interpreter;

void DisplayClasses(llvm::raw_ostream &stream,
                    const Interpreter *interpreter, bool verbose);
void DisplayClass(llvm::raw_ostream &stream,
                  const Interpreter *interpreter, const char *className,
                  bool verbose);

void DisplayGlobals(llvm::raw_ostream &stream, const Interpreter *interpreter);
void DisplayGlobal(llvm::raw_ostream &stream, const Interpreter *interpreter,
                   const std::string &name);

}

#endif

Fix fwd decl for windows.

Fix fwd decl for windows.

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


/**
 * @file llversionviewer.h
 * @brief
 *
 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2010, Linden Research, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
 *
 * 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
 *
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */

#ifndef LL_LLVERSIONVIEWER_H
#define LL_LLVERSIONVIEWER_H

const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 1;
const S32 LL_VERSION_PATCH = 2;
const S32 LL_VERSION_BUILD = 0;

const char * const LL_CHANNEL = "Second Life Developer";

#endif

/**
 * @file llversionviewer.h
 * @brief
 *
 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2010, Linden Research, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
 *
 * 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
 *
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */

#ifndef LL_LLVERSIONVIEWER_H
#define LL_LLVERSIONVIEWER_H

const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 2;
const S32 LL_VERSION_PATCH = 1;
const S32 LL_VERSION_BUILD = 0;

const char * const LL_CHANNEL = "Second Life Developer";

#endif

Increment version number since we forked for beta.


#include <binary.h>

#include <assert.h>

#include <crc32.h>

/* API ************************************************************************/

Binary *binary_new(Scope *scope, size_t size) {
  Binary *binary = scope_alloc(scope, sizeof(Binary) + size);
  binary->size   = size;
  binary->header = ref_header(TYPEID_BINARY, 0);
  memset(binary->data, 0, binary->size);
  return binary;
}

Binary *binary(Scope *scope, const uint8_t *data, size_t size) {
  Binary *binary = scope_alloc(scope, sizeof(Binary) + size);
  binary->size   = size;
  binary->header = ref_header(TYPEID_BINARY, 0);
  memcpy(binary->data, data, size);
  return binary;
}

uint32_t binary_hash32(uint32_t hash, Binary *binary) {
  assert(binary != NULL);
  return crc32(hash, binary->data, binary->size);
}

#include <binary.h>

#include <assert.h>

#include <crc32.h>

/* API ************************************************************************/

Binary *binary_new(Scope *scope, size_t size) {
  Binary *binary = scope_alloc(scope, sizeof(Binary) + size + 1);
  binary->size   = size;
  binary->header = ref_header(TYPEID_BINARY, 0);
  memset(binary->data, 0, binary->size + 1);
  return binary;
}

Binary *binary(Scope *scope, const uint8_t *data, size_t size) {
  Binary *binary = scope_alloc(scope, sizeof(Binary) + size + 1);
  binary->size   = size;
  binary->header = ref_header(TYPEID_BINARY, 0);
  memcpy(binary->data, data, size + 1);
  return binary;
}

uint32_t binary_hash32(uint32_t hash, Binary *binary) {
  assert(binary != NULL);
  return crc32(hash, binary->data, binary->size);
}

Add ending null-byte to binaries

Add ending null-byte to binaries


#ifndef MAP_EVENT_LISTENER_H
#define MAP_EVENT_LISTENER_H

#include "cocos2d.h"

namespace tsg {
namespace map {
class IMapEventListener {
public:
  virtual void onMapLoad(cocos2d::TMXTiledMap *) = 0;
  virtual void onViewCoordinatesChanged(cocos2d::Vec2) =0;
  virtual void onNightTime() =0;
  virtual void onDayTime() =0;
  virtual void onGameHourPassed() =0;

  virtual ~IMapEventListener(){};
};
}
}

#endif

#ifndef MAP_EVENT_LISTENER_H
#define MAP_EVENT_LISTENER_H

#include "cocos2d.h"

namespace tsg {
namespace map {
class IMapEventListener {
 public:
  virtual void onMapLoad(cocos2d::TMXTiledMap *) = 0;
  virtual void onViewCoordinatesChanged(cocos2d::Vec2) = 0;
  virtual void onNightTime() = 0;
  virtual void onDayTime() = 0;
  virtual void onGameHourPassed() = 0;

  virtual ~IMapEventListener(){};
};
}
}

#endif

Format previos commit with clang-formatter


#import <Foundation/Foundation.h>

//! Project version number for Quick.
FOUNDATION_EXPORT double QuickVersionNumber;

//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];

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

#import <Quick/QuickSpec.h>
#import <Quick/QCKDSL.h>
#import <Quick/QuickConfiguration.h>

#import <Foundation/Foundation.h>

//! Project version number for Quick.
FOUNDATION_EXPORT double QuickVersionNumber;

//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];

#import <Quick/QuickSpec.h>

Remove public headers from umbrella header

This seems to be the root cause for new projects created in Xcode 7.1
to report "Include of non-modular header inside framework Module
'Quick'".

Infer: It seems like the swift compiler in Xcode 7.1 now prevents
non-modular includes in umbrella header files. The public headers are
assumed to be imported in modules.


//
//  ORKCollectionResult+MORK.h
//  MORK
//
//  Created by Nolan Carroll on 4/23/15.
//  Copyright (c) 2015 Medidata Solutions. All rights reserved.
//

#import "ORKResult.h"

@interface ORKTaskResult (MORK)
@property (readonly) NSArray *mork_fieldDataFromResults;
@end

//
//  ORKCollectionResult+MORK.h
//  MORK
//
//  Created by Nolan Carroll on 4/23/15.
//  Copyright (c) 2015 Medidata Solutions. All rights reserved.
//

#import "ORKResult.h"

@interface ORKTaskResult (MORK)

- (NSArray *)mork_getFieldDataFromResults;

@end

Put method declaration back into category header


#include <stdlib.h>
#include "stdlib_noniso.h"

long atol_internal(const char* s)
{
  return 0;
}

float atof_internal(const char* s)
{
  return 0;
}

char * itoa (int val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * ltoa (long val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * utoa (unsigned int val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * ultoa (unsigned long val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags)
{
  *__s = 0;
  return __s;
}

char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s)
{
   *__s = 0;
   return __s;
}

#include <stdlib.h>
#include "stdlib_noniso.h"

extern int ets_sprintf(char*, const char*, ...);

#define sprintf ets_sprintf

long atol_internal(const char* s)
{
  long result = 0;
  return result;
}

float atof_internal(const char* s)
{
  float result = 0;
  return result;
}

char * itoa (int val, char *s, int radix)
{
  // todo: radix
  sprintf(s, "%d", val);
  return s;
}

char * ltoa (long val, char *s, int radix)
{
  sprintf(s, "%ld", val);
  return s;
}

char * utoa (unsigned int val, char *s, int radix)
{
  sprintf(s, "%u", val);
  return s;
}

char * ultoa (unsigned long val, char *s, int radix)
{
  sprintf(s, "%lu", val);
  return s;
}

char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags)
{
  *__s = 0;
  return __s;
}

char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s)
{
   *__s = 0;
   return __s;
}

Add stubs for itoa, ltoa

Add stubs for itoa, ltoa


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

#ifndef ELANG_COMPILER_AST_WITH_MODIFIERS_H_
#define ELANG_COMPILER_AST_WITH_MODIFIERS_H_

#include "elang/compiler/modifiers.h"

namespace elang {
namespace compiler {
namespace ast {

//////////////////////////////////////////////////////////////////////
//
// WithModifiers
//
class WithModifiers {
 public:
  Modifiers modifiers() const { return modifiers_; }

 protected:
  explicit WithModifiers(Modifiers modifiers);
  ~WithModifiers();

 private:
  Modifiers modifiers_;

  DISALLOW_COPY_AND_ASSIGN(WithModifiers);
};

}  // namespace ast
}  // namespace compiler
}  // namespace elang

#endif  // ELANG_COMPILER_AST_WITH_MODIFIERS_H_

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

#ifndef ELANG_COMPILER_AST_WITH_MODIFIERS_H_
#define ELANG_COMPILER_AST_WITH_MODIFIERS_H_

#include "elang/compiler/modifiers.h"

namespace elang {
namespace compiler {
namespace ast {

//////////////////////////////////////////////////////////////////////
//
// WithModifiers
//
class WithModifiers {
 public:
  Modifiers modifiers() const { return modifiers_; }

#define V(name, string, details) \
  bool Has##name() const { return modifiers_.Has##name(); }
  FOR_EACH_MODIFIER(V)
#undef V

 protected:
  explicit WithModifiers(Modifiers modifiers);
  ~WithModifiers();

 private:
  Modifiers modifiers_;

  DISALLOW_COPY_AND_ASSIGN(WithModifiers);
};

}  // namespace ast
}  // namespace compiler
}  // namespace elang

#endif  // ELANG_COMPILER_AST_WITH_MODIFIERS_H_

elang/compiler: Introduce |HasPartial()|, |HasPublic()|, and so on in |WithModifiers| class for ease of accessing modifiers.


/**
 * File:   dump.h
 * Author: Scott Bennett
 */

#ifndef DUMP_H
#define	DUMP_H
void dumpMemory();
void dumpProgramRegisters();
void dumpProcessorRegisters();
#endif	/* DUMP_H */

/*
 * File:   dump.h
 * Author: Scott Bennett
 */

#ifndef DUMP_H
#define	DUMP_H

void dumpMemory();
void dumpProgramRegisters();
void dumpProcessorRegisters();

#endif	/* DUMP_H */

Change header to C style.

Change header to C style.


#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>

#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/uio.h>

#define SERVER "127.0.0.1"
#define BUFLEN 512 // max length of buffer
#define PORT 3000 // destination port

void die(const char *s) {
  perror(s);
  exit(1);
}

int main() {
  struct sockaddr_in si_other;
  int s, slen = sizeof(si_other);

  char buf[BUFLEN];

  if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
    die("socket");
  }

  memset((char*)&si_other, 0, sizeof(si_other));
  si_other.sin_family = AF_INET;
  si_other.sin_port = htons(PORT);

  if (inet_aton(SERVER, &si_other.sin_addr) == 0) {
    fprintf(stderr, "inet_aton() failed\n");
    exit(1);
  }

  while (1) {
    printf("Enter message:\n");
    const char* msg = "hello";

    if (sendto(s, msg, strlen(msg), 0, (struct sockaddr*) &si_other, slen) == -1) {
      die("sendto()");
    }

    memset(buf, '\0', BUFLEN);
    break;
  }

  close(s);
  return 0;
}

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

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

__attribute__((noreturn))
void failed(const char* s) {
  perror(s);
  exit(1);
}

int main() {
  int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  if (s == -1) {
    failed("socket()");
  }
}

Remove broken prototype, starting out clean


#include <config.h>

#include "utest.h"

int __attribute__((weak)) main (void)
{
    return ut_run_all_tests() == 0;
}

#include <config.h>

#include "utest.h"

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

static struct option options[] = {
    { "help", no_argument, NULL, 'h' },
    { "version", no_argument, NULL, 'V' },
    { NULL, 0, 0, 0 }
};

int __attribute__((weak)) main (int argc, char **argv)
{
    int c;

    while (1) {
        int option_index;

        c = getopt_long(argc, argv, "hV", options, &option_index);
        if (c == -1) {
            break;
        }

        switch (c) {
        case 'h':
            printf("Help!\n");
            break;
        case 'V':
            printf("Version!\n");
            break;
        }
    }

    return ut_run_all_tests() == 0;
}

Add basic cmd options handling

Add basic cmd options handling


// Test ld invocation on Solaris targets.

// Check sparc-sun-solaris2.1
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN:     --target=sparc-sun-solaris2.11 \
// RUN:     --gcc-toolchain="" \
// RUN:     --sysroot=%S/Inputs/sparc-sun-solaris2.11 \
// RUN:   | FileCheck %s
// CHECK: "-cc1" "-triple" "sparc-sun-solaris2.11"
// CHECK: ld{{.*}}"
// CHECK: "--dynamic-linker" "{{.*}}/usr/lib/ld.so.1"
// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crt1.o"
// CHECK: "{{.*}}/usr/lib/crti.o"
// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtbegin.o"
// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtend.o"
// CHECK: "{{.*}}/usr/lib/crtn.o"

// Test ld invocation on Solaris targets.

// Check sparc-sun-solaris2.1
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN:     --target=sparc-sun-solaris2.11 \
// RUN:     --gcc-toolchain="" \
// RUN:     --sysroot=%S/Inputs/sparc-sun-solaris2.11 \
// RUN:   | FileCheck %s
// CHECK: "-cc1" "-triple" "sparc-sun-solaris2.11"
// CHECK: ld{{.*}}"
// CHECK: "--dynamic-linker" "{{.*}}/usr/lib/ld.so.1"
// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crt1.o"
// CHECK: "{{.*}}/usr/lib/crti.o"
// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtbegin.o"
// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtend.o"
// CHECK: "{{.*}}/usr/lib/crtn.o"

Fix path seperator for Windows.

Fix path seperator for Windows.

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


#include <stdint.h>

typedef uint8_t __u8;
typedef uint32_t __u32;

/* special address description flags for the CAN_ID */
#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
#define CAN_ERR_FLAG 0x20000000U /* error message frame */

/* valid bits in CAN ID for frame formats */
#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */

typedef __u32 canid_t;

#define CAN_SFF_ID_BITS11
#define CAN_EFF_ID_BITS29

typedef __u32 can_err_mask_t;

#define CAN_MAX_DLC 8
#define CAN_MAX_DLEN 8

struct can_frame {
    canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
    __u8    can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
    __u8    __pad;   /* padding */
    __u8    __res0;  /* reserved / padding */
    __u8    __res1;  /* reserved / padding */
    __u8    data[CAN_MAX_DLEN] __attribute__((aligned(8)));
};

struct can_filter {
    canid_t can_id;
    canid_t can_mask;
};

Use socketcan data structures and defines


// Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.

#include "test.h"

#define stringify(x) #x

void digraph(void) {
    expect_string("[", stringify(<:));
    expect_string("]", stringify(:>));
    expect_string("{", stringify(<%));
    expect_string("}", stringify(%>));
    expect_string("#", stringify(%:));
    expect_string("% :", stringify(% :));
    expect_string("##", stringify(%:%:));
    expect_string("#%", stringify(%:%));
}

void testmain(void) {
    print("lexer");
    digraph();
}

// Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.

#include "test.h"

#define stringify(x) #x

void digraph(void) {
    expect_string("[", stringify(<:));
    expect_string("]", stringify(:>));
    expect_string("{", stringify(<%));
    expect_string("}", stringify(%>));
    expect_string("#", stringify(%:));
    expect_string("% :", stringify(% :));
    expect_string("##", stringify(%:%:));
    expect_string("#%", stringify(%:%));
}

void escape(void) {
    int value = 10;
    expect(10, val\
ue);
}

void testmain(void) {
    print("lexer");
    digraph();
    escape();
}

Add a test for line continuation.

Add a test for line continuation.


#ifndef TRIANGLESTRIPGLWIDGET_H
#define TRIANGLESTRIPGLWIDGET_H

#include "GLWidget.h"
#include <cmath>

/**
 * Draws a trapezoid on screen using a triangle strip. Strips can be thought of
 * lists of vertices, where each triangle in the list is composed of some
 * adjacent group of three vertices. The vertices are colored for easy viewing.
 *
 * @author Aaron Faanes, ported by Brett Langford
 *
 */

class TriangleStripGLWidget : public GLWidget
{
public:
	TriangleStripGLWidget(QWidget* parent = 0);
protected:
	void render();
};

TriangleStripGLWidget::TriangleStripGLWidget(QWidget* parent) : GLWidget(parent) {}

void TriangleStripGLWidget::render()
{
	glBegin(GL_TRIANGLE_STRIP);

	glColor3f(1, 0, 0);
	glVertex2f(0, 0);

	glColor3f(1, 1, 0);
	glVertex2f(50, 0);

	glColor3f(0, 1, 0);
	glVertex2f(25, 50);

	glColor3f(0, 1, 1);
	glVertex2f(75, 50);

	glColor3f(0, 0, 1);
	glVertex2f(50, 100);

	glEnd();
}

#endif // TRIANGLESTRIPGLWIDGET_H

Put comment right next to class def

Put comment right next to class def

It's convention to have these without intervening spaces.


#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
#  define E_SMART_RANDR_H

Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_current_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
void e_smart_randr_monitors_create(Evas_Object *obj);
void e_smart_randr_monitor_add(Evas_Object *obj, Evas_Object *mon);
void e_smart_randr_monitor_del(Evas_Object *obj, Evas_Object *mon);

# endif
#endif

#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
#  define E_SMART_RANDR_H

Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_current_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
void e_smart_randr_monitors_create(Evas_Object *obj);
void e_smart_randr_monitor_add(Evas_Object *obj, Evas_Object *mon);
void e_smart_randr_monitor_del(Evas_Object *obj, Evas_Object *mon);
Eina_Bool e_smart_randr_changed_get(Evas_Object *obj);
void e_smart_randr_changes_apply(Evas_Object *obj, Ecore_X_Window root);

# endif
#endif

Add prototypes for randr_changed_get and randr_changes_apply functions.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 81104


#ifndef CONSTANTS_H
#define CONSTANTS_H

#if !defined(__STDC__) && !defined(__cplusplus)
#define const
#endif

/*
	Set up a boolean variable type.  Since this definition could conflict
	with other reasonable definition of BOOLEAN, i.e. using an enumeration,
	it is conditional.
*/
#ifndef BOOLEAN_TYPE_DEFINED
typedef int BOOLEAN;
#endif
#ifndef TRUE
static const int	TRUE = 1;
static const int	FALSE = 0;
#endif

/*
	Useful constants for turning seconds into larger units of time.  Since
	these constants may have already been defined elsewhere, they are
	conditional.
*/
#ifndef TIME_CONSTANTS_DEFINED
static const int	MINUTE = 60;
static const int	HOUR = 60 * 60;
static const int	DAY = 24 * 60 * 60;
#endif

/*
  This is for use with strcmp() and related functions which will return
  0 upon a match.
*/
#ifndef MATCH
static const int	MATCH = 0;
#endif
#endif

#ifndef CONSTANTS_H
#define CONSTANTS_H

#if !defined(__STDC__) && !defined(__cplusplus)
#define const
#endif

/*
	Set up a boolean variable type.  Since this definition could conflict
	with other reasonable definition of BOOLEAN, i.e. using an enumeration,
	it is conditional.
*/
#ifndef BOOLEAN_TYPE_DEFINED
typedef int BOOLEAN;
#endif

#if defined(TRUE)
#	undef TRUE
#	undef FALSE
#endif

static const int	TRUE = 1;
static const int	FALSE = 0;

/*
	Useful constants for turning seconds into larger units of time.  Since
	these constants may have already been defined elsewhere, they are
	conditional.
*/
#ifndef TIME_CONSTANTS_DEFINED
static const int	MINUTE = 60;
static const int	HOUR = 60 * 60;
static const int	DAY = 24 * 60 * 60;
#endif

/*
  This is for use with strcmp() and related functions which will return
  0 upon a match.
*/
#ifndef MATCH
static const int	MATCH = 0;
#endif
#endif

Make sure "TRUE" and "FALSE" are undefined before setting them up as constant int's.


// Messages are the scrolling messages within the UI.
// This file contains update and retrieval functions.

#include "7drltypes.h"

#define MAX_MSG_SIZE   ( 80 )

static int oldest_message = ( MAX_MESSAGES - 1 );

char messages[ MAX_MESSAGES ][ MAX_MSG_SIZE ];

void init_messages( void )
{
   bzero( messages, ( size_t ) sizeof( messages ) );

   return;
}

void add_message( char *message )
{

}

char *get_message( int pos )
{
   return NULL;

}

Add start of messaging interface.

Add start of messaging interface.