////
//    __|  |  | _ _| __  /  __|   \ |
//  \__ \  __ |   |     /   _|   .  |
//  ____/ _| _| ___| ____| ___| _|\_|
//
// Copyright (c) 2017 Jacob Hauberg Hansen
//
// This library is free software; you can redistribute and modify it
// under the terms of the MIT license. See LICENSE for details.
//

#ifndef zint_h
#define zint_h

#include <stdint.h>

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;

typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;

typedef float f32;
typedef double f64;

#endif /* zint_h */

Add standard integer/floating point types

These help make variable intention clearer and declarations shorter.


/* Header testing function definitions parsing. */

//Defining a standard function.
void f(int, int);
inline int g(char *ch, char **str);

// Defining a function pointer.
int(*fnPtr)(char, float);

// Adding dllexport and stdcall annotation to a function.
int __declspec(dllexport) __stdcall function1();

/* Header testing function definitions parsing. */

//Defining a standard function.
void f(int, int);

// Defining a function with its implementation following
inline int g(char *ch, char **str)
{
     JUNK
     { }
     int localVariable = 1;
}

// Defining a function pointer.
int(*fnPtr)(char, float);

// Adding dllexport and stdcall annotation to a function.
int __declspec(dllexport) __stdcall function1();

Add back Luke test of a function followed by its concrete implementation.


/* Based on https://en.cppreference.com/w/cpp/algorithm/for_each
   Need to be built in C11 mode */

#include <stdio.h>
#include "m-array.h"
#include "m-algo.h"

/* Define a dynamic array of int */
ARRAY_DEF(vector_int, int)
#define M_OPL_vector_int_t() ARRAY_OPLIST(vector_int)

/* Define operator increment on int */
#define INC(n) (n)++

int main(void)
{
  M_LET( (nums, 3, 4, 2, 8, 15, 267), vector_int_t) {
    // Print the array before
    printf ("before:");
    ALGO_FOR_EACH(nums, vector_int_t, M_PRINT, " ");
    printf ("\n");

    // Increment each element of the array
    ALGO_FOR_EACH(nums, vector_int_t, INC);

    // Print the array after
    printf ("after: ");
    ALGO_FOR_EACH(nums, vector_int_t, M_PRINT, " ");
    printf ("\n");

    // Sum the elements of the array
    int sum = 0;
    ALGO_REDUCE(sum, nums, vector_int_t, add);
    M_PRINT("sum = ", sum, "\n");
  }
  return 0;
}

Add example of ALGO_FOR_EACH and ALGO_REDUCE


/*
 * licensed to the apache software foundation (asf) under one
 * or more contributor license agreements.  see the notice file
 * distributed with this work for additional information
 * regarding copyright ownership.  the asf licenses this file
 * to you 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 _OS_FAULT_H
#define _OS_FAULT_H

#ifdef __cplusplus
extern "c" {
#endif

void __assert_func(const char *, int, const char *, const char *)
    __attribute((noreturn));

#ifdef __cplusplus
}
#endif

#endif /* _OS_FAULT_H */

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 _OS_FAULT_H
#define _OS_FAULT_H

#ifdef __cplusplus
extern "c" {
#endif

void __assert_func(const char *, int, const char *, const char *)
    __attribute((noreturn));

#ifdef __cplusplus
}
#endif

#endif /* _OS_FAULT_H */

Update License to match other licenses

Update License to match other licenses


#include "fitz_base.h"
#include "fitz_stream.h"

fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
	fz_error reason;
	unsigned char *oldrp;
	unsigned char *oldwp;

	assert(!out->eof);

	oldrp = in->rp;
	oldwp = out->wp;

	if (f->done)
	    return fz_iodone;

	reason = f->process(f, in, out);

	assert(in->rp <= in->wp);
	assert(out->wp <= out->ep);

	f->consumed = in->rp > oldrp;
	f->produced = out->wp > oldwp;
	f->count += out->wp - oldwp;

	/* iodone or error */
	if (reason != fz_ioneedin && reason != fz_ioneedout)
	{
		if (reason != fz_iodone)
			reason = fz_rethrow(reason, "cannot process filter");
		out->eof = 1;
		f->done = 1;
	}

	return reason;
}

fz_filter *
fz_keepfilter(fz_filter *f)
{
	f->refs ++;
	return f;
}

void
fz_dropfilter(fz_filter *f)
{
	if (--f->refs == 0)
	{
		if (f->drop)
			f->drop(f);
		fz_free(f);
	}
}

#include "fitz_base.h"
#include "fitz_stream.h"

fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
	fz_error reason;
	unsigned char *oldrp;
	unsigned char *oldwp;

	oldrp = in->rp;
	oldwp = out->wp;

	if (f->done)
	    return fz_iodone;

	assert(!out->eof);

	reason = f->process(f, in, out);

	assert(in->rp <= in->wp);
	assert(out->wp <= out->ep);

	f->consumed = in->rp > oldrp;
	f->produced = out->wp > oldwp;
	f->count += out->wp - oldwp;

	/* iodone or error */
	if (reason != fz_ioneedin && reason != fz_ioneedout)
	{
		if (reason != fz_iodone)
			reason = fz_rethrow(reason, "cannot process filter");
		out->eof = 1;
		f->done = 1;
	}

	return reason;
}

fz_filter *
fz_keepfilter(fz_filter *f)
{
	f->refs ++;
	return f;
}

void
fz_dropfilter(fz_filter *f)
{
	if (--f->refs == 0)
	{
		if (f->drop)
			f->drop(f);
		fz_free(f);
	}
}

Move assert test of EOF to after testing if a filter is done.

darcs-hash:20090823143236-f546f-8a43aacda84fc3a1ab9b24c9cd54bd422912d4ec.gz


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

// Linux implementation of OS Abstraction Layer for Canopy

#include <canopy_os.h>

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

void canopy_os_assert(int condition) {
    assert(condition);
}

void * canopy_os_alloc(size_t size) {
    return malloc(size);
}

void * canopy_os_calloc(int count, size_t size) {
    return calloc(count, size);
}

void canopy_os_free(void *ptr) {
    free(ptr);
}

void canopy_os_log(const char *format, ...) {
    va_list ap;
    va_start(ap, format);
    vfprintf(stderr, format, ap);
    va_end(ap);
}

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

// Linux implementation of OS Abstraction Layer for Canopy

#include <canopy_os.h>

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

void * canopy_os_alloc(size_t size) {
    return malloc(size);
}

void * canopy_os_calloc(int count, size_t size) {
    return calloc(count, size);
}

void canopy_os_free(void *ptr) {
    free(ptr);
}

void canopy_os_log(const char *format, ...) {
    va_list ap;
    va_start(ap, format);
    vfprintf(stderr, format, ap);
    va_end(ap);
}

Remove canopy_os_assert implementation because linux implementation now just expands to assert macro in header file


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

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

Update Skia milestone to 105

Update Skia milestone to 105

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


#include "game_logic.h"
new_game_result bship_logic_new_game(void){
	new_game_result r;
	r.gid = 5;
	r.pid = 7;
	return r;
}

plyr_id bship_logic_join_game(game_id gid) {
	if(gid != 5)
		return ERR_NO_SUCH_GAME;
	return 8;
}

int bship_logic_submit_grid(plyr_id pid, grid _g) {
	if(pid < 7 || pid > 8)
		return ERR_INVALID_PLYR_ID;
	return 0;
}

int bship_logic_bomb_position(plyr_id pid, int x, int y) {
	if(pid < 7 || pid > 8)
		return ERR_INVALID_PLYR_ID;
	if(x < 0 || y < 0)
		return ERR_INVALID_BOMB_TARGET;
	return 0;
}

get_game_end_result bship_logic_get_game_end(plyr_id pid) {
	get_game_end_result g;
	g.won = 0;
	g.game_over = 0;
	return g;
}

static plyr_id stored_pid = 0;
static plyr_state stored_state;
static void* stored_user;

int bship_logic_request_notify(plyr_id pid, plyr_state state, void *user) {
	if(stored_pid > 0)
		bship_logic_notification(stored_pid, stored_state, stored_user, 1);
	stored_pid = pid;
	stored_state = state;
	stored_user = user;
	return 0;
}

Add dummy implementation of game_logic.h for testing


//
//  SearchItem.h
//  bikepath
//
//  Created by Farheen Malik on 8/15/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>

@interface SearchItem : NSObject

@property NSString *searchQuery;
@property CLLocationDegrees lati;
@property CLLocationDegrees longi;
@property CLLocationCoordinate2D position;
@property (readonly) NSDate *creationDate;

@end

//
//  SearchItem.h
//  bikepath
//
//  Created by Farheen Malik on 8/15/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>

@interface SearchItem : NSObject

@property NSString *searchQuery;
@property CLLocationDegrees lati;
@property CLLocationDegrees longi;
@property CLLocationCoordinate2D position;
@property NSString *address;
@property (readonly) NSDate *creationDate;

@end

Add address as property of Search Item object


#pragma once
#include "../main.h"

class Socket {
	public:
		virtual ~Socket() {}
		virtual unsigned int apiVersion() = 0;
		virtual void connect(const std::string& server, const std::string& port, const std::string& bind = "") {}
		virtual std::string receive() { return ""; }
		virtual void send(const std::string& data) {}
		virtual void closeConnection() {}
		bool isConnected() { return connected; }
	protected:
		bool connected;
};

#pragma once
#include "../main.h"

class Socket {
	public:
		virtual ~Socket() {}
		virtual unsigned int apiVersion() = 0;
		virtual void connect(const std::string& server, const std::string& port, const std::string& bindAddr = "") {}
		virtual std::string receive() { return ""; }
		virtual void send(const std::string& data) {}
		virtual void closeConnection() {}
		bool isConnected() { return connected; }
	protected:
		bool connected;
};

Rename parameter to not be the same as the name of the function that does it


/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $
Version:   $Revision: 21985 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef mitkRenderingTestHelper_h
#define mitkRenderingTestHelper_h

#include <string>
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <mitkRenderWindow.h>

class vtkRenderWindow;
class vtkRenderer;

namespace mitk
{
  class DataStorage;
}

class MITK_CORE_EXPORT mitkRenderingTestHelper
{
  public:
    mitkRenderingTestHelper(int width, int height, mitk::DataStorage* ds);

    ~mitkRenderingTestHelper();

    vtkRenderer* GetVtkRenderer();
    vtkRenderWindow* GetVtkRenderWindow();
    void SaveAsPNG(std::string fileName);

  protected:
    mitk::RenderWindow::Pointer m_RenderWindow;

};

#endif

/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $
Version:   $Revision: 21985 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef mitkRenderingTestHelper_h
#define mitkRenderingTestHelper_h

#include <string>
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <mitkRenderWindow.h>

class vtkRenderWindow;
class vtkRenderer;

namespace mitk
{
  class DataStorage;
}

class mitkRenderingTestHelper
{
  public:
    mitkRenderingTestHelper(int width, int height, mitk::DataStorage* ds);

    ~mitkRenderingTestHelper();

    vtkRenderer* GetVtkRenderer();
    vtkRenderWindow* GetVtkRenderWindow();
    void SaveAsPNG(std::string fileName);

  protected:
    mitk::RenderWindow::Pointer m_RenderWindow;

};

#endif

Fix linker warnings in rendering tests

Fix linker warnings in rendering tests


/**************************************************************************
 *
 * Copyright 2009 Artur Wyszynski <harakash@gmail.com>
 * Copyright 2013 Alexander von Gluck IV <kallisti5@unixzen.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 **************************************************************************/
#ifndef _HGL_SOFTWAREWINSYS_H
#define _HGL_SOFTWAREWINSYS_H

struct sw_winsys;

struct sw_winsys* hgl_create_sw_winsys(void);

#endif

/**************************************************************************
 *
 * Copyright 2009 Artur Wyszynski <harakash@gmail.com>
 * Copyright 2013 Alexander von Gluck IV <kallisti5@unixzen.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 **************************************************************************/
#ifndef _HGL_SOFTWAREWINSYS_H
#define _HGL_SOFTWAREWINSYS_H

#ifdef __cplusplus
extern "C" {
#endif

struct sw_winsys;

struct sw_winsys* hgl_create_sw_winsys(void);

#ifdef __cplusplus
}
#endif

#endif

Add needed extern "C" to hgl winsys

winsys/hgl: Add needed extern "C" to hgl winsys

Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>


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

/**
 *    @file
 *      Project-specific configuration file for iOS builds.
 *
 */
#ifndef WEAVEPROJECTCONFIG_H
#define WEAVEPROJECTCONFIG_H

#endif /* WEAVEPROJECTCONFIG_H */

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

/**
 *    @file
 *      Project-specific configuration file for iOS builds.
 *
 */
#ifndef WEAVEPROJECTCONFIG_H
#define WEAVEPROJECTCONFIG_H

#define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0

#endif /* WEAVEPROJECTCONFIG_H */

Disable unsupported Inet configuration breaking iOS integration.

For a yet-unknown reason, trying to read the TCP Tx buffer with ioctl on iOS fails with ENXIO. Since this code was written primarily for embedded Linux platforms, and is not needed for mobile clients, this CL turns off that bit of code for iOS builds.


#pragma once

#include "../3RVX/Window.h"

class NotifyIcon;
class Settings;

class UpdaterWindow : public Window {
public:
    UpdaterWindow();
    ~UpdaterWindow();

    void DoModal();

private:
    HICON _smallIcon;
    HICON _largeIcon;
    NotifyIcon *_notifyIcon;

    HMENU _menu;
    UINT _menuFlags;

    Settings *_settings;

    std::pair<int, int> _version;
    std::wstring _versionString;

    void InstallUpdate();

    virtual LRESULT WndProc(HWND hWnd, UINT message,
        WPARAM wParam, LPARAM lParam);

public:
    static const int MENU_INSTALL = 0;
    static const int MENU_IGNORE = 1;
    static const int MENU_REMIND = 2;

};

#pragma once

#include "../../3RVX/Window.h"
#include "Version.h"

class NotifyIcon;
class Settings;

class UpdaterWindow : public Window {
public:
    UpdaterWindow();
    ~UpdaterWindow();

    void DoModal();

private:
    HICON _smallIcon;
    HICON _largeIcon;
    NotifyIcon *_notifyIcon;

    HMENU _menu;
    UINT _menuFlags;

    Settings *_settings;

    Version _version;

    void InstallUpdate();

    virtual LRESULT WndProc(HWND hWnd, UINT message,
        WPARAM wParam, LPARAM lParam);

public:
    static const int MENU_INSTALL = 0;
    static const int MENU_IGNORE = 1;
    static const int MENU_REMIND = 2;

};

Clean up instance variables and imports

Clean up instance variables and imports


// RUN: %clang_cc1  -std=c99 %s -emit-llvm -o - | grep -v llvm.isunordered | not grep call

_Bool A, B, C, D, E, F;
void TestF(float X, float Y) {
  A = __builtin_isgreater(X, Y);
  B = __builtin_isgreaterequal(X, Y);
  C = __builtin_isless(X, Y);
  D = __builtin_islessequal(X, Y);
  E = __builtin_islessgreater(X, Y);
  F = __builtin_isunordered(X, Y);
}
void TestD(double X, double Y) {
  A = __builtin_isgreater(X, Y);
  B = __builtin_isgreaterequal(X, Y);
  C = __builtin_isless(X, Y);
  D = __builtin_islessequal(X, Y);
  E = __builtin_islessgreater(X, Y);
  F = __builtin_isunordered(X, Y);
}

// RUN: %clang_cc1  -std=c99 %s -emit-llvm -o - | FileCheck %s
// CHECK: @Test
// CHECK-NOT: call

_Bool A, B, C, D, E, F;
void TestF(float X, float Y) {
  A = __builtin_isgreater(X, Y);
  B = __builtin_isgreaterequal(X, Y);
  C = __builtin_isless(X, Y);
  D = __builtin_islessequal(X, Y);
  E = __builtin_islessgreater(X, Y);
  F = __builtin_isunordered(X, Y);
}
void TestD(double X, double Y) {
  A = __builtin_isgreater(X, Y);
  B = __builtin_isgreaterequal(X, Y);
  C = __builtin_isless(X, Y);
  D = __builtin_islessequal(X, Y);
  E = __builtin_islessgreater(X, Y);
  F = __builtin_isunordered(X, Y);
}

Remove pathname dependence. Also rewrite test to use FileCheck
at the same time.

Patch by David Callahan.

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


#ifndef VolViz_Geometry_h
#define VolViz_Geometry_h

#include "Types.h"

namespace VolViz {

struct GeometryDescriptor {
  bool movable{true};
  Color color{Colors::White()};
};

struct AxisAlignedPlaneDescriptor : public GeometryDescriptor {
  Length intercept{0 * meter};
  Axis axis{Axis::X};
};

} // namespace VolViz

#endif // VolViz_Geometry_h

Add descriptors for various geometries

Add descriptors for various geometries


// RUN: %ucc -DFIRST  -S -o- %s | grep -F 'movl (%%rax), %%eax'
// RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rbx), %%ebx'

#ifdef FIRST

f(int *p)
{
	return *p;
	// should see that p isn't used after/.retains==1 and not create a new reg,
	// but re-use the current
}

#elif defined(SECOND)

struct A
{
	int i, j;
};

g(struct A *p)
{
	return p->i + p->j;
}

#else
#  error neither
#endif

// RUN: %ucc -DFIRST  -S -o- %s | grep -F 'movl (%%rax), %%eax'
// RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rcx), %%ecx'

#ifdef FIRST

f(int *p)
{
	return *p;
	// should see that p isn't used after/.retains==1 and not create a new reg,
	// but re-use the current
}

#elif defined(SECOND)

struct A
{
	int i, j;
};

g(struct A *p)
{
	return p->i + p->j;
}

#else
#  error neither
#endif

Change test now %ebx is callee-save

Change test now %ebx is callee-save


#ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__

#include <json-glib/json-types.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>

#endif /* __JSON_GLIB_H__ */

#ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__

#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>

#endif /* __JSON_GLIB_H__ */

Add json-scanner.h to the exported headers


#ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__

#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>

#endif /* __JSON_GLIB_H__ */

#ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__

#include <json-glib/json-types.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>

#endif /* __JSON_GLIB_H__ */

Remove the include for json-scanner.h

Remove the include for json-scanner.h

The json-scanner.h header file is not shipped with JSON-GLib anymore.


//
//  NSTLocalFileError.h
//  Pods
//
//  Created by Anatoly Shcherbinin on 5.04.22.
//

#ifndef NSTLocalFileError_h
#define NSTLocalFileError_h

///Quick error domain for errors that should be generated and handled localy in one source file
#define NSTLocalFileErrorDomain (@__FILE_NAME__)

///Convenience method for generation errors with localized description
///Generated error will have file name where occured as domain and code as line
#define NSTLocalFileErrorWithMessage(message) _localFileErrorWithMessage(NSTLocalFileErrorDomain, __LINE__, (message))

///Convenience method for generation errors with cpecefied code
///Can be used if error handled in the same file and error handling if depends on code
#define NSTLocalFileErrorWithCode(code) _localFileErrorWithMessage(NSTLocalFileErrorDomain, (code), nil)

CF_INLINE NSError *_localFileErrorWithMessage(NSErrorDomain domain, NSInteger code, NSString *message) {
    return [NSError errorWithDomain:domain
                               code:code
                           userInfo:( nil == message
        ? nil
        : @ { NSLocalizedDescriptionKey: message }
    )];
}

#endif /* NSTLocalFileError_h */

Add convenience macros for generation locally handled errors


#include <assert.h>
#include "../src/chip8.c"

void test_clear_screen(void) {
  int i;
  chip8_t * chip8 = chip8_new();

  chip8->memory[0x200] = 0x00;
  chip8->memory[0x201] = 0xE0;

  chip8_fetch_current_opcode(chip8);
  chip8_decode_current_opcode(chip8);

  i = 0;
  while (i < 64 * 32) {
    assert(chip8->memory[i++] == 0);
  }
}

void test_instruction_jump(void) {
  chip8_t * chip8 = chip8_new();

  chip8->memory[0x200] = 0x11;
  chip8->memory[0x201] = 0x23;

  chip8_fetch_current_opcode(chip8);
  chip8_decode_current_opcode(chip8);

  assert(chip8->program_counter == 0x123);
}

int main(int argc, char ** argv) {
  test_clear_screen();
  test_instruction_jump();
}

#include <assert.h>
#include "../src/chip8.c"

void test_clear_screen(void) {
  int i;
  chip8_t * chip8 = chip8_new();

  chip8->memory[0x200] = 0x00;
  chip8->memory[0x201] = 0xE0;

  chip8_fetch_current_opcode(chip8);
  chip8_decode_current_opcode(chip8);

  i = 0;
  while (i < 64 * 32) {
    assert(chip8->memory[i++] == 0);
  }
}

void test_instruction_jump(void) {
  chip8_t * chip8 = chip8_new();

  chip8->memory[0x200] = 0x11;
  chip8->memory[0x201] = 0x23;

  chip8_fetch_current_opcode(chip8);
  chip8_decode_current_opcode(chip8);

  assert(chip8->program_counter == 0x123);
}

int main(int argc, char ** argv) {
  test_clear_screen();
  test_instruction_jump();

  return 0;
}

Exit the tests with success if they aren't failing


#include "plrCompare.h"

int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) {
  int foundDiff = 0;
  if      (args1->addr   != args2->addr)   { foundDiff = 1; }
  else if (args1->arg[0] != args2->arg[0]) { foundDiff = 2; }
  else if (args1->arg[1] != args2->arg[1]) { foundDiff = 3; }
  else if (args1->arg[2] != args2->arg[2]) { foundDiff = 4; }
  else if (args1->arg[3] != args2->arg[3]) { foundDiff = 5; }
  else if (args1->arg[4] != args2->arg[4]) { foundDiff = 6; }
  else if (args1->arg[5] != args2->arg[5]) { foundDiff = 7; }
  return foundDiff;
}

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

int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) {
  int faultVal = 0;

  #define CompareElement(elem, faultBit)    \
  if (args1->elem != args2->elem) {         \
    faultVal |= 1 << faultBit;              \
    printf("Argument miscompare in " #elem ", 0x%lX != 0x%lX\n",  \
      (unsigned long)args1->elem, (unsigned long)args2->elem);    \
  }

  CompareElement(addr,   0);
  CompareElement(arg[0], 1);
  CompareElement(arg[1], 2);
  CompareElement(arg[2], 3);
  CompareElement(arg[3], 4);
  CompareElement(arg[4], 5);
  CompareElement(arg[5], 6);

  return faultVal;
}

Add logging to syscall arg compare for debugging purposes


#pragma once

#include "simply_window.h"

#include "simply_msg.h"

#include "simply.h"

#include "util/sdk.h"

#include <pebble.h>

typedef struct SimplyWindowStack SimplyWindowStack;

struct SimplyWindowStack {
  Simply *simply;
#ifdef PBL_SDK_2
  Window *pusher;
#endif
  bool is_showing:1;
  bool is_hiding:1;
};

SimplyWindowStack *simply_window_stack_create(Simply *simply);
void simply_window_stack_destroy(SimplyWindowStack *self);

bool simply_window_stack_set_broadcast(bool broadcast);

SimplyWindow *simply_window_stack_get_top_window(Simply *simply);

void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, bool is_push);
void simply_window_stack_pop(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_back(SimplyWindowStack *self, SimplyWindow *window);

void simply_window_stack_send_show(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_send_hide(SimplyWindowStack *self, SimplyWindow *window);

bool simply_window_stack_handle_packet(Simply *simply, Packet *packet);

#pragma once

#include "simply_window.h"

#include "simply_msg.h"

#include "simply.h"

#include "util/sdk.h"

#include <pebble.h>

typedef struct SimplyWindowStack SimplyWindowStack;

struct SimplyWindowStack {
  Simply *simply;
  SDK_SELECT(NONE, Window *pusher);
  bool is_showing:1;
  bool is_hiding:1;
};

SimplyWindowStack *simply_window_stack_create(Simply *simply);
void simply_window_stack_destroy(SimplyWindowStack *self);

bool simply_window_stack_set_broadcast(bool broadcast);

SimplyWindow *simply_window_stack_get_top_window(Simply *simply);

void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, bool is_push);
void simply_window_stack_pop(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_back(SimplyWindowStack *self, SimplyWindow *window);

void simply_window_stack_send_show(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_send_hide(SimplyWindowStack *self, SimplyWindow *window);

bool simply_window_stack_handle_packet(Simply *simply, Packet *packet);

Use SDK_SELECT for the window stack pusher member field


/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    21.07.2015
 */

#ifndef STR_INHIBIT_LIBCALL_H_
#define STR_INHIBIT_LIBCALL_H_

/* FIXME  __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
 * can be not supported in cross-compiler
 */
#define HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 1

#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
# define inhibit_loop_to_libcall \
	    __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
#else
# define inhibit_loop_to_libcall
#endif

#endif /* STR_INHIBIT_LIBCALL_H_ */

/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    21.07.2015
 */

#ifndef STR_INHIBIT_LIBCALL_H_
#define STR_INHIBIT_LIBCALL_H_

/* FIXME  __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
 * can be not supported in cross-compiler
 */
#ifndef __e2k__
#define HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 1
#endif /* __e2k__ */

#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
# define inhibit_loop_to_libcall \
	    __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
#else
# define inhibit_loop_to_libcall
#endif

#endif /* STR_INHIBIT_LIBCALL_H_ */

compat: Fix inhibit_loop_to_libcall compilation on e2k


//
//  UIColor+HKHex.h
//  HKProjectBase-Sample
//
//  Created by Harley.xk on 15/8/26.
//  Copyright (c) 2015年 Harley.xk. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIColor (HKHex)

+ (UIColor *)colorWithHexString:(NSString *)hexString;
+ (UIColor *)colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha;

@end

//
//  UIColor+HKHex.h
//  HKProjectBase-Sample
//
//  Created by Harley.xk on 15/8/26.
//  Copyright (c) 2015年 Harley.xk. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIColor (HKHex)

/**
 *  使用16进制字符串创建颜色
 *
 *  @param hexString 16进制字符串，可以是 0XFFFFFF/#FFFFFF/FFFFFF 三种格式之一
 *
 *  @return 返回创建的UIColor对象
 */
+ (UIColor *)colorWithHexString:(NSString *)hexString;
+ (UIColor *)colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha;

@end

Add comment to Hex color category

Add comment to Hex color category


#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
//#include <locale>

class ConfigFileReader
{
    public:
        ConfigFileReader(const char* file_name);
        std::string find(std::string key);
    private:
        std::ifstream iniFile;
        std::unordered_map<std::string, std::string> hashmap;
};

#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>

class ConfigFileReader
{
    public:
        ConfigFileReader(const char* file_name);
        std::string find(std::string key);
    private:
        std::ifstream iniFile;
        std::unordered_map<std::string, std::string> hashmap;
};

Remove unnecessary includes and newlines


/* Copyright (c) 2004 Timo Sirainen */

#include "lib.h"
#include "str.h"
#include "str-sanitize.h"

void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
	const char *p;

	for (p = src; *p != '\0'; p++) {
		if ((unsigned char)*p < 32)
			break;
	}

	str_append_n(dest, src, (size_t)(p - src));
	for (; *p != '\0' && max_len > 0; p++, max_len--) {
		if ((unsigned char)*p < 32)
			str_append_c(dest, '?');
		else
			str_append_c(dest, *p);
	}

	if (*p != '\0') {
		str_truncate(dest, str_len(dest)-3);
		str_append(dest, "...");
	}
}

const char *str_sanitize(const char *src, size_t max_len)
{
	string_t *str;

	str = t_str_new(I_MIN(max_len, 256));
	str_sanitize_append(str, src, max_len);
	return str_c(str);
}

/* Copyright (c) 2004 Timo Sirainen */

#include "lib.h"
#include "str.h"
#include "str-sanitize.h"

void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
	const char *p;

	for (p = src; *p != '\0'; p++) {
		if (((unsigned char)*p & 0x7f) < 32)
			break;
	}

	str_append_n(dest, src, (size_t)(p - src));
	for (; *p != '\0' && max_len > 0; p++, max_len--) {
		if (((unsigned char)*p & 0x7f) < 32)
			str_append_c(dest, '?');
		else
			str_append_c(dest, *p);
	}

	if (*p != '\0') {
		str_truncate(dest, str_len(dest)-3);
		str_append(dest, "...");
	}
}

const char *str_sanitize(const char *src, size_t max_len)
{
	string_t *str;

	str = t_str_new(I_MIN(max_len, 256));
	str_sanitize_append(str, src, max_len);
	return str_c(str);
}

Convert also 0x80..0x9f characters to '?'


/**
 * \file   os_copyfile.c
 * \brief  Copy a file from one location to another.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

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

int os_copyfile(lua_State* L)
{
	int z;
	const char* src = luaL_checkstring(L, 1);
	const char* dst = luaL_checkstring(L, 2);

#if PLATFORM_WINDOWS
	z = CopyFileA(src, dst, FALSE);
#else
	lua_pushfstring(L, "cp %s %s", src, dst);
	z = (system(lua_tostring(L, -1)) == 0);
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to copy file to '%s'", dst);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

/**
 * \file   os_copyfile.c
 * \brief  Copy a file from one location to another.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

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

int os_copyfile(lua_State* L)
{
	int z;
	const char* src = luaL_checkstring(L, 1);
	const char* dst = luaL_checkstring(L, 2);

#if PLATFORM_WINDOWS
	z = CopyFileA(src, dst, FALSE);
#else
	lua_pushfstring(L, "cp \"%s\" \"%s\"", src, dst);
	z = (system(lua_tostring(L, -1)) == 0);
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to copy file to '%s'", dst);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

Host/Posix: Fix os.copyfile with spaces in argument paths.


#ifndef ROLE_H_
#define ROLE_H_

#include "State.h"

class Role{
    public:
    State& state;
    int x,y;
    Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {}
    int getID(){
        return id;
    }
    virtual void move() = 0;
    private:
        //changing id is impossible
        int id;
};

#endif

#ifndef ROLE_H_
#define ROLE_H_

#include "State.h"
#include "Location.h"

#include <vector>

// this class is partial abstract
class Role {

public:

	// reference to the main state
    State& state;

    // neighbors
    std::vector<int> neighbors;

private:

    // position of the ant
    int x, y;

    // ant's id
    int id;

public:

	// -- virtual functions that will be implemented separately

    // communicate
	virtual void receive ( int msg ) {
		// do nothing
	}

	// action move
    virtual int move() = 0;

    void run(void) const {

    	int result = move();

    	if ( 0 < result and result < TDIRECTION ) {
	    	state.makeMove( getLocation(), result );
    	}
    }

    // helper functions

    // return location of the ant
    Location getLocation(void) const {
    	return Location( x, y );
    }

    // return the id of the ant
    int getID() const {
        return id;
    }

    // constructor
    Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {}

};

#endif

Add more features ( made it more functional )


class dccChat : public Module {
	public:
		void onDCCReceive(std::string dccid, std::string message);
};

class dccSender : public Module {
	public:
		void dccSend(std::string dccid, std::string message);
};

class dccChat : public Module {
	public:
		virtual void onDCCReceive(std::string dccid, std::string message);
};

class dccSender : public Module {
	public:
		virtual void dccSend(std::string dccid, std::string message);
		virtual bool hookDCCMessage(std::string modName, std::string hookMsg);
};

Fix those functions not being virtual.

Fix those functions not being virtual.


%{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}

#include <Cutelyst/Controller>

%{JS: Cpp.openNamespaces('%{Class}')}\
using namespace Cutelyst;

class %{CN} : public Controller
{
     Q_OBJECT
@if %{CustomNamespace}
     C_NAMESPACE("%{CustomNamespaceValue}")
@endif
public:
    explicit %{CN}(QObject *parent = 0);

    C_ATTR(index, :Path)
    void index(Context *c);

private Q_SLOTS:
@if %{BeginMethod}
    bool Begin(Context *c) override;

@endif
@if %{AutoMethod}
    bool Auto(Context *c) override;

@endif
@if %{EndMethod}
    bool End(Context *c) override;

@endif
};
%{JS: Cpp.closeNamespaces('%{Class}')}
#endif // %{GUARD}\

%{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}

#include <Cutelyst/Controller>

%{JS: Cpp.openNamespaces('%{Class}')}\
using namespace Cutelyst;

class %{CN} : public Controller
{
     Q_OBJECT
@if %{CustomNamespace}
     C_NAMESPACE("%{CustomNamespaceValue}")
@endif
public:
    explicit %{CN}(QObject *parent = 0);

    C_ATTR(index, :Path)
    void index(Context *c);

private Q_SLOTS:
@if %{BeginMethod}
    bool Begin(Context *c);

@endif
@if %{AutoMethod}
    bool Auto(Context *c);

@endif
@if %{EndMethod}
    bool End(Context *c);

@endif
};
%{JS: Cpp.closeNamespaces('%{Class}')}
#endif // %{GUARD}\

Remove override form Begin Auto End methods of QtCreator plugin as they don't override anymore


// RUN: %clang_cc1 -emit-llvm -march=armv7a %s

// XFAIL: *
// XTARGET: arm

typedef struct __simd128_uint16_t
{
  __neon_uint16x8_t val;
} uint16x8_t;

void b(uint16x8_t sat, uint16x8_t luma)
{
  __asm__("vmov.16 %1, %0   \n\t"
                                           "vtrn.16 %0, %1   \n\t"
   :"=w"(luma), "=w"(sat)
   :"0"(luma)
   );

}

// RUN: %clang -S -emit-llvm -arch arm -march=armv7a %s
typedef unsigned short uint16_t;
typedef __attribute__((neon_vector_type(8))) uint16_t uint16x8_t;

void b(uint16x8_t sat, uint16x8_t luma)
{
  __asm__("vmov.16 %1, %0   \n\t"
                                           "vtrn.16 %0, %1   \n\t"
   :"=w"(luma), "=w"(sat)
   :"0"(luma)
   );

}

Fix this test to work for arm and on all platforms.

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


/*
 * This file is part of ui-tests
 *
 * Copyright © 2016 Ikey Doherty <ikey@solus-project.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */

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

BUDGIE_BEGIN_PEDANTIC
#include "popover.h"
BUDGIE_END_PEDANTIC

int main(int argc, char **argv)
{
        gtk_init(&argc, &argv);

        return EXIT_FAILURE;
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 expandtab:
 * :indentSize=8:tabSize=8:noTabs=true:
 */

/*
 * This file is part of ui-tests
 *
 * Copyright © 2016 Ikey Doherty <ikey@solus-project.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */

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

BUDGIE_BEGIN_PEDANTIC
#include "popover.h"
BUDGIE_END_PEDANTIC

int main(int argc, char **argv)
{
        gtk_init(&argc, &argv);
        GtkWidget *window = NULL;

        window = budgie_popover_new();
        g_signal_connect(window, "destroy", gtk_main_quit, NULL);
        gtk_widget_show_all(window);

        gtk_main();

        return EXIT_SUCCESS;
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 expandtab:
 * :indentSize=8:tabSize=8:noTabs=true:
 */

Make the demo use the popover

Make the demo use the popover

Signed-off-by: Ikey Doherty <d8d992cf0016e35c2a8339d5e7d44bebd12a2d77@solus-project.com>


//===-- llvm/Target/TargetMachineImpls.h - Target Descriptions --*- C++ -*-===//
//
// This file defines the entry point to getting access to the various target
// machine implementations available to LLVM.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H
#define LLVM_TARGET_TARGETMACHINEIMPLS_H

namespace TM {
  enum {
    PtrSizeMask  = 1,
    PtrSize32    = 0,
    PtrSize64    = 1,

    EndianMask   = 2,
    LittleEndian = 0,
    BigEndian    = 2,
  };
}

class TargetMachine;

// allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
// that implements the Sparc backend.
//
TargetMachine *allocateSparcTargetMachine();

// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
// that implements the X86 backend.  The X86 target machine can run in
// "emulation" mode, where it is capable of emulating machines of larger pointer
// size and different endianness if desired.
//
TargetMachine *allocateX86TargetMachine(unsigned Configuration =
					   TM::PtrSize32|TM::LittleEndian);

#endif

//===-- llvm/Target/TargetMachineImpls.h - Target Descriptions --*- C++ -*-===//
//
// This file defines the entry point to getting access to the various target
// machine implementations available to LLVM.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H
#define LLVM_TARGET_TARGETMACHINEIMPLS_H

namespace TM {
  enum {
    PtrSizeMask  = 1,
    PtrSize32    = 0,
    PtrSize64    = 1,

    EndianMask   = 2,
    LittleEndian = 0,
    BigEndian    = 2,
  };
}

class TargetMachine;

// allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
// that implements the Sparc backend.
//
TargetMachine *allocateSparcTargetMachine(unsigned Configuration =
                                          TM::PtrSize64|TM::BigEndian);

// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
// that implements the X86 backend.  The X86 target machine can run in
// "emulation" mode, where it is capable of emulating machines of larger pointer
// size and different endianness if desired.
//
TargetMachine *allocateX86TargetMachine(unsigned Configuration =
                                        TM::PtrSize32|TM::LittleEndian);

#endif

Allow allocation of a Sparc TargetMachine.

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


//
// Copyright (C) 2008 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2008 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////

#ifndef _MpIntResourceMsg_h_
#define _MpIntResourceMsg_h_

// SYSTEM INCLUDES

// APPLICATION INCLUDES
#include "mp/MpResourceMsg.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS

/// Message used to pass an integer value to resource.
class MpIntResourceMsg : public MpResourceMsg
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

/* ============================ CREATORS ================================== */
///@name Creators
//@{

     /// Constructor
   MpIntResourceMsg(MpResourceMsgType type,
                    const UtlString& targetResourceName,
                    int data)
   : MpResourceMsg(type, targetResourceName)
   , mData(data)
   {
   };

     /// Copy constructor
   MpIntResourceMsg(const MpIntResourceMsg &msg)
   : MpResourceMsg(msg)
   , mData(msg.mData)
   {
   };

     /// @copydoc MpResourceMsg::createCopy()
   OsMsg* createCopy() const
   {
      return new MpIntResourceMsg(*this);
   }

//@}

/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{

   /// Assignment operator
   MpIntResourceMsg& operator=(const MpIntResourceMsg& rhs)
   {
        if(&rhs == this)
        {
            return(*this);
        }

        MpResourceMsg::operator=(rhs);

        mData = rhs.mData;

        return *this;
   }

//@}

/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{

     /// Return contained integer.
   int getData() const {return mData;}

//@}

/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{

//@}

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
   int mData;      ///< Integer to be passed to resource.
};

/* ============================ INLINE METHODS ============================ */

#endif  // _MpIntResourceMsg_h_

Add resource message bearing some abstract integer.

git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@10873 a612230a-c5fa-0310-af8b-88eea846685b


/** @file
  GUIDs used for UEFI Memory Attributes Table in the UEFI 2.6 specification.

  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __UEFI_MEMORY_ATTRIBUTES_TABLE_H__
#define __UEFI_MEMORY_ATTRIBUTES_TABLE_H__

#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID {\
  0xdcfa911d, 0x26eb, 0x469f, {0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20} \
}

typedef struct {
  UINT32                Version;
  UINT32                NumberOfEntries;
  UINT32                DescriptorSize;
  UINT32                Reserved;
//EFI_MEMORY_DESCRIPTOR Entry[1];
} EFI_MEMORY_ATTRIBUTES_TABLE;

#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION  0x00000001

extern EFI_GUID gEfiMemoryAttributesTableGuid;

#endif

MdePkg: Add UEFI2.6 MemoryAttributes Table definition.

Add UEFI2.6 MemoryAttributes Table definition header
file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <364a90bfebd1f362ebb7b48e4bf8ec010adef203@intel.com>
Reviewed-by: "Gao, Liming" <6480311aeeb4b006862f6d13ebabddc03f51e507@intel.com>


// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | FileCheck %s
// PR 5406

// XFAIL: *
// XTARGET: arm

typedef struct { char x[3]; } A0;
void foo (int i, ...);

// CHECK: call arm_aapcscc  void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
  A0 a3;
  a3.x[0] = 0;
  a3.x[0] = 0;
  a3.x[2] = 26;
  foo (1,  a3 );
  return 0;
}

// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | FileCheck %s
// PR 5406

// XFAIL: *
// XTARGET: arm

typedef struct { char x[3]; } A0;
void foo (int i, ...);

// CHECK: call void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
  A0 a3;
  a3.x[0] = 0;
  a3.x[0] = 0;
  a3.x[2] = 26;
  foo (1,  a3 );
  return 0;
}

Update test to match recent llvm-gcc change.

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


#include <cxxtest/TestSuite.h>
#include "../log/EyeLog.h"

class ExperimentSuite: public CxxTest::TestSuite
{
public:

    bool entryVecsAreEqual(const PEntryVec& v1, const PEntryVec& v2)
    {
        if (v1.size() != v2.size())
            return false;
        for (auto i = PEntryVec::size_type(0); i < v1.size(); i++) {
            if (v1[i]->compare(*v2[i]) != 0)
                return false;
        }
        return true;
    }

    void testMetaComparison()
    {
        TS_TRACE("Testing PExperiment comparisons");
        PEntryVec meta;
        PEntryVec metacp;
        meta.push_back(new PGazeEntry(LGAZE, 0, 10, 10, 0));
        meta.push_back(new PGazeEntry(RGAZE, 0, 10, 10, 0));
        meta.push_back(new PGazeEntry(LGAZE, 1, 10, 10, 0));
        meta.push_back(new PGazeEntry(RGAZE, 1, 10, 10, 0));
        meta.push_back(new PMessageEntry(2, "Hi"));

        metacp = copyPEntryVec(meta);

        PExperiment expmeta (meta);
        PExperiment expmetacp(metacp);

        // Test whether two identical are identical
        TS_ASSERT_EQUALS(expmeta, expmetacp);
        metacp.push_back(new PTrialEntry());

        // Test whether a length difference compares as unequal
        TS_ASSERT_DIFFERS(expmeta, PExperiment(metacp));

        destroyPEntyVec(metacp);
        metacp = copyPEntryVec(meta);
        delete metacp[3];
        // note that in the next the pupil size if different
        metacp[3] = new PGazeEntry(RGAZE, 1, 10, 10, 1);
        TS_ASSERT_DIFFERS(expmeta, PExperiment(metacp));
        destroyPEntyVec(metacp);
        destroyPEntyVec(meta);
    }

};

Add ExperimentSuit to test PExperment and PTrial


/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#include "e.h"
#include <execinfo.h>

/* a tricky little devil, requires e and it's libs to be built
 * with the -rdynamic flag to GCC for any sort of decent output.
 */
void e_sigseg_act(int x, siginfo_t *info, void *data){

  void *array[255];
  size_t size;
  write(2, "**** SEGMENTATION FAULT ****\n", 29);
  write(2, "**** Printing Backtrace... *****\n\n", 34);
  size = backtrace(array, 255);
  backtrace_symbols_fd(array, size, 2);
  exit(-11);
}

/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 * NOTE TO FreeBSD users. Install libexecinfo from
 * ports/devel/libexecinfo and add -lexecinfo to LDFLAGS
 * to add backtrace support.
 */
#include "e.h"
#include <execinfo.h>

/* a tricky little devil, requires e and it's libs to be built
 * with the -rdynamic flag to GCC for any sort of decent output.
 */
void e_sigseg_act(int x, siginfo_t *info, void *data){

  void *array[255];
  size_t size;
  write(2, "**** SEGMENTATION FAULT ****\n", 29);
  write(2, "**** Printing Backtrace... *****\n\n", 34);
  size = backtrace(array, 255);
  backtrace_symbols_fd(array, size, 2);
  exit(-11);
}

Add note to help FreeBSD users.

Add note to help FreeBSD users.

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@13781 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


Use nullptr instead of 0

COMMON: Use nullptr instead of 0


#define container_of(p,T,memb) (T *)((char *)(p) - offsetof(T,member))
#define length_of(array) (sizeof (array) / sizeof 0[array])

size_t align_to(size_t offset, size_t align);

Add container_of and length_of macros to base


/**
 * @file debug_msg.c Debug Message function
 */
/* $Id$ */
#include "gangliaconf.h"

int debug_level = 0;

/**
 * @fn void debug_msg(const char *format, ...)
 * Prints the message to STDERR if DEBUG is #defined
 * @param format The format of the msg (see printf manpage)
 * @param ... Optional arguments
 */
void
debug_msg(const char *format, ...)
{
   if (debug_level && format)
      {
         va_list ap;
         va_start(ap, format);
         vfprintf(stderr, format, ap);
         fprintf(stderr,"\n");
         va_end(ap);
      }
   return;
}

/**
 * @file debug_msg.c Debug Message function
 */
/* $Id$ */
#include "gangliaconf.h"

int debug_level = 0;

/**
 * @fn void debug_msg(const char *format, ...)
 * Prints the message to STDERR if DEBUG is #defined
 * @param format The format of the msg (see printf manpage)
 * @param ... Optional arguments
 */
void
debug_msg(const char *format, ...)
{
   if (debug_level > 1 && format)
      {
         va_list ap;
         va_start(ap, format);
         vfprintf(stderr, format, ap);
         fprintf(stderr,"\n");
         va_end(ap);
      }
   return;
}

Debug level 1 now only shows error messages (and no backgrounding in gmetad).

git-svn-id: 27e0aca8c7a52a9ae65dfba2e16879604119af8c@188 93a4e39c-3214-0410-bb16-828d8e3bcd0f


/*
    Copyright (C) 2011 Sebastian Pancratz

    This file is part of FLINT.

    FLINT is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include <gmp.h>
#include <stdlib.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_poly.h"

void fmpz_poly_factor_clear(fmpz_poly_factor_t fac)
{
    if (fac->alloc)
    {
        slong i;

        for (i = 0; i < fac->alloc; i++)
        {
            fmpz_poly_clear(fac->p + i);
        }

        fmpz_clear(&(fac->c));
        flint_free(fac->p);
        flint_free(fac->exp);
        fac->p   = NULL;
        fac->exp = NULL;
    }
}

/*
    Copyright (C) 2011 Sebastian Pancratz

    This file is part of FLINT.

    FLINT is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include <gmp.h>
#include <stdlib.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_poly.h"

void fmpz_poly_factor_clear(fmpz_poly_factor_t fac)
{
    if (fac->alloc)
    {
        slong i;

        for (i = 0; i < fac->alloc; i++)
        {
            fmpz_poly_clear(fac->p + i);
        }

        flint_free(fac->p);
        flint_free(fac->exp);
        fac->p   = NULL;
        fac->exp = NULL;
    }

    fmpz_clear(&(fac->c));
}

Fix a memory leak in t-factor.

Fix a memory leak in t-factor.


//
//  GITTreeEntryTests.h
//  CocoaGit
//
//  Created by Geoffrey Garside on 06/10/2008.
//  Copyright 2008 ManicPanda.com. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>

@class GITRepo, GITTree;
@interface GITTreeEntryTests : GHTestCase {
    GITRepo * repo;
    GITTree * tree;
    NSUInteger entryMode;
    NSString * entryName;
    NSString * entrySHA1;
    NSString * entryLine;
}

@property(readwrite,retain) GITRepo * repo;
@property(readwrite,retain) GITTree * tree;
@property(readwrite,assign) NSUInteger entryMode;
@property(readwrite,copy) NSString * entryName;
@property(readwrite,copy) NSString * entrySHA1;
@property(readwrite,copy) NSString * entryLine;

- (void)testShouldParseEntryLine;
- (void)testShouldInitWithModeNameAndHash;
- (void)testShouldInitWithModeStringNameAndHash;

@end

//
//  GITTreeEntryTests.h
//  CocoaGit
//
//  Created by Geoffrey Garside on 06/10/2008.
//  Copyright 2008 ManicPanda.com. All rights reserved.
//

#import <GHUnit/GHUnit.h>

@class GITRepo, GITTree;
@interface GITTreeEntryTests : GHTestCase {
    GITRepo * repo;
    GITTree * tree;
    NSUInteger entryMode;
    NSString * entryName;
    NSString * entrySHA1;
    NSString * entryLine;
}

@property(readwrite,retain) GITRepo * repo;
@property(readwrite,retain) GITTree * tree;
@property(readwrite,assign) NSUInteger entryMode;
@property(readwrite,copy) NSString * entryName;
@property(readwrite,copy) NSString * entrySHA1;
@property(readwrite,copy) NSString * entryLine;

- (void)testShouldParseEntryLine;
- (void)testShouldInitWithModeNameAndHash;
- (void)testShouldInitWithModeStringNameAndHash;

@end

Update GITTreeEntry tests to use GHUnit framework instead of SenTestKit


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

int main (int argc, char *argv[]) {
    int i;
    int found = 0;
    if(argc < 2) return 1;
    UdonParser *udon = udon_new_parser_from_file(argv[1]);
    if(udon == NULL) {
        udon_emit_error(stderr);
        return udon_error_value();
    }
    for(i=0; i<10000; i++) {
        found += udon_parse(udon);
        udon_reset_parser(udon);
    }
    udon_free_parser(udon);
    printf("%d\n", found);
}

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

int main (int argc, char *argv[]) {
    int i;
    if(argc < 2) return 1;
    UdonParser *udon = udon_new_parser_from_file(argv[1]);
    if(udon == NULL) {
        udon_emit_error(stderr);
        return udon_error_value();
    }
    int res = udon_parse(udon);
    if(res) udon_emit_error(stderr);
    udon_reset_parser(udon);
    udon_free_parser(udon);
    return res;
}

Remove older benchmarking loop and do correct error handling with real parse interface.


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

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

int main(void)
{
  printf("--  Generated by utildgen.c from system bfd.h\n");

  printf("with Interfaces.C;\n");
  printf("package Util.Systems.Constants is\n");
  printf("\n");

  printf("\n   --  Flags used when opening a file with open/creat.\n");
  printf("   O_RDONLY                      : constant Interfaces.C.int := 8#%06o#;\n", O_RDONLY);
  printf("   O_WRONLY                      : constant Interfaces.C.int := 8#%06o#;\n", O_WRONLY);
  printf("   O_RDWR                        : constant Interfaces.C.int := 8#%06o#;\n", O_RDWR);
  printf("   O_CREAT                       : constant Interfaces.C.int := 8#%06o#;\n", O_CREAT);
  printf("   O_EXCL                        : constant Interfaces.C.int := 8#%06o#;\n", O_EXCL);
  printf("   O_TRUNC                       : constant Interfaces.C.int := 8#%06o#;\n", O_TRUNC);
  printf("   O_APPEND                      : constant Interfaces.C.int := 8#%06o#;\n", O_APPEND);

  printf("\n");

  printf("   --  Flags used by fcntl\n");
  printf("   F_SETFL                       : constant Interfaces.C.int := %d;\n", F_SETFL);
  printf("   FD_CLOEXEC                    : constant Interfaces.C.int := %d;\n", FD_CLOEXEC);

  printf("\n");

  printf("end Util.Systems.Constants;\n");
  return 0;
}

Add a support tool to generate Util.Systems.Constants package


/*
 * Copyright © 2009 CNRS
 * Copyright © 2009-2010 INRIA.  All rights reserved.
 * Copyright © 2009 Université Bordeaux 1
 * Copyright © 2009-2011 Cisco Systems, Inc.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <private/autogen/config.h>

#ifdef HWLOC_HAVE_XML

#include <hwloc.h>
#include <string.h>

#include "lstopo.h"

void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
{
  if (!filename || !strcasecmp(filename, "-.xml"))
    filename = "-";

  hwloc_topology_export_xml(topology, filename);
}

#endif /* HWLOC_HAVE_XML */

/*
 * Copyright © 2009 CNRS
 * Copyright © 2009-2010 INRIA.  All rights reserved.
 * Copyright © 2009 Université Bordeaux 1
 * Copyright © 2009-2011 Cisco Systems, Inc.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <private/autogen/config.h>

#ifdef HWLOC_HAVE_XML

#include <hwloc.h>
#include <string.h>

#include "lstopo.h"

void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
{
  if (!filename || !strcasecmp(filename, "-.xml"))
    filename = "-";

  if (hwloc_topology_export_xml(topology, filename) < 0) {
    fprintf(stderr, "Failed to export XML to %s (%s)\n", filename, strerror(errno));
    return;
  }
}

#endif /* HWLOC_HAVE_XML */

Print an error when lstopo fails to export to XML

git-svn-id: 14be032f8f42541b1a281b51ae8ea69814daf20e@3691 4b44e086-7f34-40ce-a3bd-00e031736276


//
//  main.c
//  fast-xattr-test
//
//  Created by David Schlachter on 2015-07-09.
//  Copyright (c) 2015 David Schlachter. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}

//
//  main.c
//  fast-xattr-test
//
//  Created by David Schlachter on 2015-07-09.
//  Copyright (c) 2015 David Schlachter. All rights reserved.
//

#include <stdio.h>
#include <sys/xattr.h>
#include <stdlib.h>

int main(int argc, const char * argv[]) {
    const char *path;
    const char *name;
    void *value = malloc(15);
    size_t size;
    u_int32_t position;
    int options = 0;

    path = argv[1];
    name = argv[2];
    size = 14;
    position = 0;

    if (!getxattr(path, name, value, size, position, options)) {
        return 0;
    } else {
        return 1;
    };
}

Set up the getxattr function

Set up the getxattr function


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

#include <parserutils/parserutils.h>

#include "input/filter.h"

#include "testutils.h"

static void *myrealloc(void *ptr, size_t len, void *pw)
{
	UNUSED(pw);

	return realloc(ptr, len);
}

int main(int argc, char **argv)
{
	parserutils_filter *input;
	parserutils_filter_optparams params;

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

	assert(parserutils_initialise(argv[1], myrealloc, NULL) ==
			PARSERUTILS_OK);

	assert(parserutils_filter_create("UTF-8", myrealloc, NULL, &input) ==
			PARSERUTILS_OK);

	params.encoding.name = "GBK";
	assert(parserutils_filter_setopt(input,
			PARSERUTILS_FILTER_SET_ENCODING, &params) ==
			PARSERUTILS_BADENCODING);

	params.encoding.name = "GBK";
	assert(parserutils_filter_setopt(input,
			PARSERUTILS_FILTER_SET_ENCODING, &params) ==
			PARSERUTILS_BADENCODING);

	parserutils_filter_destroy(input);

	assert(parserutils_finalise(myrealloc, NULL) == PARSERUTILS_OK);

	printf("PASS\n");

	return 0;
}

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

#include <parserutils/parserutils.h>

#include "input/filter.h"

#include "testutils.h"

static void *myrealloc(void *ptr, size_t len, void *pw)
{
	UNUSED(pw);

	return realloc(ptr, len);
}

int main(int argc, char **argv)
{
	parserutils_filter *input;
	parserutils_filter_optparams params;
	parserutils_error expected;

#ifdef WITH_ICONV_FILTER
	expected = PARSERUTILS_OK;
#else
	expected = PARSERUTILS_BADENCODING;
#endif

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

	assert(parserutils_initialise(argv[1], myrealloc, NULL) ==
			PARSERUTILS_OK);

	assert(parserutils_filter_create("UTF-8", myrealloc, NULL, &input) ==
			PARSERUTILS_OK);

	params.encoding.name = "GBK";
	assert(parserutils_filter_setopt(input,
			PARSERUTILS_FILTER_SET_ENCODING, &params) ==
			expected);

	params.encoding.name = "GBK";
	assert(parserutils_filter_setopt(input,
			PARSERUTILS_FILTER_SET_ENCODING, &params) ==
			expected);

	parserutils_filter_destroy(input);

	assert(parserutils_finalise(myrealloc, NULL) == PARSERUTILS_OK);

	printf("PASS\n");

	return 0;
}

Fix regression test to work with iconv filter enabled

svn path=/trunk/libparserutils/; revision=5662


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

#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_

#include <sys/types.h>

#include "OrbitBase/Result.h"

namespace orbit_user_space_instrumentation {

[[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid);

[[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid);

}  // namespace orbit_user_space_instrumentation

#endif  // USER_SPACE_INSTRUMENTATION_ATTACH_H_

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

#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_

#include <sys/types.h>

#include "OrbitBase/Result.h"

namespace orbit_user_space_instrumentation {

// Attaches to and stops all threads of the process `pid` using `PTRACE_ATTACH`. Being attached to a
// process using this function is a precondition for using any of the tooling provided here.
[[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid);

// Detaches from all threads of the process `pid` and continues the execution.
[[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid);

}  // namespace orbit_user_space_instrumentation

#endif  // USER_SPACE_INSTRUMENTATION_ATTACH_H_

Fix missing comment in header.

Fix missing comment in header.


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

#include <rhph_defs.h>
#include <rhph_hash.h>
#include <rhph_graph.h>

#endif /* !RGPH_H_INCLUDED */

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

#include <rgph_defs.h>
#include <rgph_hash.h>
#include <rgph_graph.h>

#endif /* !RGPH_H_INCLUDED */

Fix typo in include file names.

Fix typo in include file names.


#include "location.h"
#include "inventory.h"
#include "person.h"

void location_init(struct location *location, char *name, char *description)
{
    location->name = name;
    location->description = description;
    inventory_init(&location->inventory);
    vector_init(&location->people, sizeof(struct person *));
}

void location_free(struct location *location)
{
    for (int i = 0; i < location->people.size; i++) {
        person_free(location->people.data[i]);
    }

    vector_free(&location->people);
    inventory_free(&location->inventory);
}

#include "location.h"
#include "inventory.h"
#include "person.h"

void location_init(struct location *location, char *name, char *description)
{
    location->name = name;
    location->description = description;
    inventory_init(&location->inventory);
    vector_init(&location->people, sizeof(struct person *));
}

void location_free(struct location *location)
{
    for (int i = 0; i < location->people.size; i++) {
        person_free(vector_get(&location->people, i));
    }

    vector_free(&location->people);
    inventory_free(&location->inventory);
}

Use vector_get rather than accessing array directly


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

long int f[39];
long int r[39];

long int fib(long int n) {
    if (n == 0) {
        return f[0];
    }

    if (f[n] != 0) {
        return f[n];
    }

    f[n] = fib(n - 1) + fib(n - 2);
    r[n] = r[n - 1] + r[n - 2] + 2;

    return f[n];
}

int main() {
    int i, j;
    long int n;

    memset(f, 0, sizeof(f));
    memset(r, 0, sizeof(r));
    f[1] = 1;

    scanf("%d", &i);
    while (i--) {
        scanf("%ld", &n);
        printf("fib(%ld) = %ld calls = %ld\n", n, r[n], fib(n));
    }

    return 0;
}

Solve Fibonacci, How Many Calls? in c

Solve Fibonacci, How Many Calls? in c


/* -*- c -*- */

/*
   Project:     libFIRM
   File name:   ir/ana/gnu_ext.c
   Purpose:     Provide some GNU CC extensions to the rest of the world
   Author:      Florian
   Modified by:
   Created:     Sat Nov 13 19:35:27 CET 2004
   CVS-ID:      $Id$
   Copyright:   (c) 1999-2005 Universitt Karlsruhe
   Licence:     This file is protected by the GPL -  GNU GENERAL PUBLIC LICENSE.
*/

# ifdef HAVE_CONFIG_H
#  include "config.h"
# endif

/*
  gnu_ext: Provide some GNU CC extensions to the rest of the world
*/

/* Includes */

/* Local Defines: */
# if defined (__GNUC__)
/* then we're all set */
# else /* defined __GNUC__ */
#  define __FUNCTION__  "::"
#  define __PRETTY_FUNCTION__ ":::"
# endif /* define __GNUC__ */

/* Local Data Types: */

/* Local Variables: */

/* Local Prototypes: */

/* ===================================================
   Local Implementation:
   =================================================== */

/* ===================================================
   Exported Implementation:
   =================================================== */

/*
  $Log$
  Revision 1.1  2005/01/14 14:15:19  liekweg
  Support GNU extensions on non-GNU platforms

*/

Support GNU extensions on non-GNU platforms

[r4924]


#include <stdio.h>

int main(int argc, char ** argv){
    printf("Test\n");
    return 0;
}

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

int main(int argc, char ** argv){
    printf("Test\n");
    void* test = malloc(1024*1024);
    if(test > 0){
        printf("Malloc\n");
        free(test);
        printf("Free\n");
    }else{
        printf("Malloc Failed\n");
    }
    return 0;
}

Fix bugs with libc, executor

WIP: Fix bugs with libc, executor


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

struct termios orig_termios;

void disable_raw_mode() {
	tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enable_raw_mode() {
	tcgetattr(STDIN_FILENO, &orig_termios);
	atexit(disable_raw_mode);

	struct termios raw = orig_termios;
	raw.c_iflag &= ~(ICRNL | IXON);
	raw.c_oflag &= ~(OPOST);
	raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);

	tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
	enable_raw_mode();

	char c;
	while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
		if (iscntrl(c)) {
			printf("%d\n", c);
		} else {
			printf("%d ('%c')\n", c, c);
		}
	}
	return 0;
}

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

struct termios orig_termios;

void disable_raw_mode() {
	tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enable_raw_mode() {
	tcgetattr(STDIN_FILENO, &orig_termios);
	atexit(disable_raw_mode);

	struct termios raw = orig_termios;
	raw.c_iflag &= ~(ICRNL | IXON);
	raw.c_oflag &= ~(OPOST);
	raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);

	tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
	enable_raw_mode();

	char c;
	while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
		if (iscntrl(c)) {
			printf("%d\r\n", c);
		} else {
			printf("%d ('%c')\r\n", c, c);
		}
	}
	return 0;
}

Fix printf() by adding CR manually

Fix printf() by adding CR manually


/*===- LineProfiling.c - Support library for line profiling ---------------===*\
|*
|*                     The LLVM Compiler Infrastructure
|*
|* This file is distributed under the University of Illinois Open Source
|* License. See LICENSE.TXT for details.
|*
|*===----------------------------------------------------------------------===*|
|*
|* This file implements the call back routines for the line profiling
|* instrumentation pass. Link against this library when running code through
|* the -insert-line-profiling LLVM pass.
|*
\*===----------------------------------------------------------------------===*/

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

/* A file in this case is a translation unit. Each .o file built with line
 * profiling enabled will emit to a different file. Only one file may be
 * started at a time.
 */
void llvm_prof_linectr_start_file(const char *orig_filename) {
  printf("[%s]\n", orig_filename);
}

/* Emit data about a counter to the data file. */
void llvm_prof_linectr_emit_counter(const char *dir, const char *file,
                                    uint32_t line, uint32_t column,
                                    uint64_t *counter) {
  printf("%s/%s:%u:%u %lu\n", dir, file, line, column, *counter);
}

void llvm_prof_linectr_end_file() {
  printf("-----\n");
}

/*===- LineProfiling.c - Support library for line profiling ---------------===*\
|*
|*                     The LLVM Compiler Infrastructure
|*
|* This file is distributed under the University of Illinois Open Source
|* License. See LICENSE.TXT for details.
|*
|*===----------------------------------------------------------------------===*|
|*
|* This file implements the call back routines for the line profiling
|* instrumentation pass. Link against this library when running code through
|* the -insert-line-profiling LLVM pass.
|*
\*===----------------------------------------------------------------------===*/

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

#include "llvm/Support/DataTypes.h"

/* A file in this case is a translation unit. Each .o file built with line
 * profiling enabled will emit to a different file. Only one file may be
 * started at a time.
 */
void llvm_prof_linectr_start_file(const char *orig_filename) {
  printf("[%s]\n", orig_filename);
}

/* Emit data about a counter to the data file. */
void llvm_prof_linectr_emit_counter(const char *dir, const char *file,
                                    uint32_t line, uint32_t column,
                                    uint64_t *counter) {
  printf("%s/%s:%u:%u %" PRIu64 "\n", dir, file, line, column, *counter);
}

void llvm_prof_linectr_end_file() {
  printf("-----\n");
}

Print our uint64_t with the more portable (C99 and C++0x) %PRIu64 format
specifier.

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


#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int f(void*, void*));

#endif

#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));

#endif

Fix missing parenthesis around f as parameter


#include "kms-endpoint.h"
#include <glib.h>

int main(int argc, char **argv) {
	GObject *ep;
	GValue val = G_VALUE_INIT;
	GError *err = NULL;
	KmsConnection *conn = NULL;

	g_type_init();

	ep = g_object_new(KMS_TYPE_ENDPOINT, "localname", "test_ep", NULL);

	if (ep == NULL) {
		g_print("Create endpont is: NULL\n");
		return 1;
	}

	g_value_init(&val, G_TYPE_STRING);

	g_object_get_property(ep, "localname", &val);

	g_print("Created ep with localname: %s\n", g_value_get_string(&val));

	conn = kms_endpoint_create_connection(KMS_ENDPOINT(ep),
						KMS_CONNECTION_TYPE_RTP, &err);

	if (conn == NULL) {
		g_print("Connection can not be created: %s\n", err->message);;
		g_error_free(err);
		goto end;
	}

end:
	g_object_unref(ep);

	return 0;
}

#include "kms-endpoint.h"
#include <glib.h>

int main(int argc, char **argv) {
	GObject *ep;
	GValue val = G_VALUE_INIT;
	GError *err = NULL;
	KmsConnection *conn = NULL;

	g_type_init();

	ep = g_object_new(KMS_TYPE_ENDPOINT, "localname", "test_ep", NULL);

	if (ep == NULL) {
		g_print("Create endpont is: NULL\n");
		return 1;
	}

	g_value_init(&val, G_TYPE_STRING);

	g_object_get_property(ep, "localname", &val);

	g_print("Created ep with localname: %s\n", g_value_get_string(&val));

	conn = kms_endpoint_create_connection(KMS_ENDPOINT(ep),
						KMS_CONNECTION_TYPE_RTP, &err);

	if (conn == NULL) {
		g_print("Connection can not be created: %s\n", err->message);;
		g_error_free(err);
		goto end;
	}

	g_object_get_property(G_OBJECT(conn), "id", &val);

	g_print("Created local connection with id: %s\n",
						g_value_get_string(&val));

	if (!kms_endpoint_delete_connection(KMS_ENDPOINT(ep), conn, &err)) {
		g_printerr("Connection can not be deleted: %s", err->message);
		g_error_free(err);
		goto end;
	}

end:
	g_object_unref(ep);

	return 0;
}

Add test for delete connection method

Add test for delete connection method


#ifndef LOGSMODEL
#define LOGSMODEL

#include <QString>
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QTextStream>
#include <QStandardPaths>
#include "Helpers/constants.h"

namespace Models {
    class LogsModel : public QObject {
        Q_OBJECT
    public:
        Q_INVOKABLE QString getAllLogsText() {
            QString result;
#ifdef QT_NO_DEBUG
            QDir logFileDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
            QString logFilePath = logFileDir.filePath(Constants::LOG_FILENAME);
            QFile f(logFilePath);

            if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
                QTextStream in(&f);
                result = in.readAll();
            }
#else
            result = "Logs are available in Release version";
#endif
            return result;

        }
    };
}

#endif // LOGSMODEL

#ifndef LOGSMODEL
#define LOGSMODEL

#include <QString>
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QTextStream>
#include <QStandardPaths>
#include "../Helpers/constants.h"

namespace Models {
    class LogsModel : public QObject {
        Q_OBJECT
    public:
        Q_INVOKABLE QString getAllLogsText() {
            QString result;
#ifdef QT_NO_DEBUG
            QDir logFileDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
            QString logFilePath = logFileDir.filePath(Constants::LOG_FILENAME);
            QFile f(logFilePath);

            if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
                QTextStream in(&f);
                result = in.readAll();
            }
#else
            result = "Logs are available in Release version";
#endif
            return result;

        }
    };
}

#endif // LOGSMODEL

Fix for compilation in Windows

Fix for compilation in Windows


/* headers */
#include <stdlib.h>
#include <time.h>

#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"

/* main body function */
int main()
{
    int L; /* square lattice size */
    double p; /* occupation probability of each lattice site */
    int *lattice; /* lattice array */

    /* initialize random number generator seed */
    srand(time(NULL));

    /* allocate lattice */
    L = 10;
    lattice = allocate_lattice(L, L);

    /* populate lattice with given probability */
    p = 0.4;
    populate_lattice(p, lattice, L, L);

    /* print the generated lattice for visualization */
    print_lattice(lattice, L, L, 1);

    /* label clusters and print result */
    label_clusters(lattice, L, L);
    print_lattice(lattice, L, L, 1);

    /* free memory before leaving */
    free(lattice);

    return 0;
}

/* headers */
#include <stdlib.h>
#include <time.h>

#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"

/* main body function */
int main(int argc, char ** argv)
{
    int L; /* square lattice size */
    double p; /* occupation probability of each lattice site */
    int *lattice; /* lattice array */

    /* read input arguments; if none provided fallback to default values */
    if (argc == 3) {
        L = atoi(argv[1]);
        p = atof(argv[2]);
    } else {
        L = 10;
        p = 0.4;
    }

    /* initialize random number generator seed */
    srand(time(NULL));

    /* allocate lattice */
    lattice = allocate_lattice(L, L);

    /* populate lattice with given probability */
    populate_lattice(p, lattice, L, L);

    /* print the generated lattice for visualization */
    print_lattice(lattice, L, L, 1);

    /* label clusters and print result */
    label_clusters(lattice, L, L);
    print_lattice(lattice, L, L, 1);

    /* free memory before leaving */
    free(lattice);

    return 0;
}

[percolation] Add passing problem parameters as program arguments


// RUN: %clang -### %s -c -o tmp.o -Wa,--noexecstack 2>&1 | grep "mnoexecstack"

// RUN: %clang -### %s -c -o tmp.o -triple i686-pc-linux-gnu -integrated-as -Wa,--noexecstack 2>&1 | grep "mnoexecstack"

Fix this test on machines that don't run clang -cc1as when asked to assemble.

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


#include "Inputs/zeroFunctionFile.h"

int foo(int x) {
  return NOFUNCTIONS(x);
}
int main() {
  return foo(2);
}

// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata

// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPORT --strict-whitespace %s
// REPORT: 0                 0         -           0                 0         -               0               0         -           0                 0         -
// REPORT-NO: 0%

// RUN: llvm-cov show %S/Inputs/zeroFunctionFile.covmapping -format html -instr-profile %t.profdata -o %t.dir
// RUN: FileCheck %s -input-file=%t.dir/index.html -check-prefix=HTML
// HTML: <td class='column-entry-green'><pre>- (0/0)
// HTML-NO: 0.00% (0/0)

#include "Inputs/zeroFunctionFile.h"

int foo(int x) {
  return NOFUNCTIONS(x);
}
int main() {
  return foo(2);
}

// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata

// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPORT --strict-whitespace %s
// REPORT: 0                 0         -           0                 0         -               0               0         -           0                 0         -
// REPORT-NO: 0%

// RUN: llvm-cov show -j 1 %S/Inputs/zeroFunctionFile.covmapping -format html -instr-profile %t.profdata -o %t.dir
// RUN: FileCheck %s -input-file=%t.dir/index.html -check-prefix=HTML
// HTML: <td class='column-entry-green'><pre>- (0/0)
// HTML-NO: 0.00% (0/0)

Disable threading in a test. NFC.

[llvm-cov] Disable threading in a test. NFC.

PR30735 reports an issue where llvm-cov hangs with a worker thread
waiting on a condition, and the main thread waiting to join() the
workers. While this doesn't appear to be a bug in llvm-cov or the
ThreadPool implementation, it would be helpful to disable the use of
threading in the llvm-cov tests where no test coverage is added.

More context: https://bugs.llvm.org/show_bug.cgi?id=30735

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


task blink();

task usercontrol(){
	int DY, DT;
	bool isReset = false;
	startTask(blink);

	//Enable Positioning System
	startTask(positionsystem);

	while(true){
		//Driving
		DY = threshold(PAIRED_CH2^2 / MAX_POWER, 5);
		DT = threshold(PAIRED_CH1^2 / MAX_POWER, 5);
		drive(DY, DT);

		//Mogo
		mogo(threshold(PAIRED_CH3, 15));

		//Arm
		arm((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);

		//Lift
		lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);

		//Intake
		intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);

		//Reset (can be done multiple times, only required once)
		if(SensorValue[resetButton]){
			resetAll();
			isReset = true;
			stopTask(blink);
			SensorValue[resetLED] = false;
			waitUntil(!SensorValue[resetButton]);
		}
	}
}

task blink(){
	while(true){
		SensorValue[resetLED] = !SensorValue[resetLED];
		wait1Msec(1000);
	}
}

task blink();

task usercontrol(){
	int DY, DT;
	bool isReset = false;
	startTask(blink);

	//Enable Positioning System
	startTask(positionsystem);

	while(true){
		//Driving
		DY = threshold(PAIRED_CH2^2 / MAX_POWER, 5) + ((PAIRED_BTN8U - PAIRED_BTN8D) * MAX_POWER);
		DT = threshold(PAIRED_CH1^2 / MAX_POWER, 5) + ((PAIRED_BTN8R - PAIRED_BTN8L) * MAX_POWER);
		drive(DY, DT);

		//Mogo
		mogo(threshold(PAIRED_CH3, 15));

		//Arm
		arm((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);

		//Lift
		lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);

		//Intake
		intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);

		//Reset (can be done multiple times, only required once)
		if(abs(SensorValue[aclZ]) > 50){
			startTask(blink);
		}
		if(SensorValue[resetButton]){
			resetAll();
			isReset = true;
			stopTask(blink);
			SensorValue[resetLED] = false;
			waitUntil(!SensorValue[resetButton]);
		}
	}
}

task blink(){
	while(true){
		SensorValue[resetLED] = !SensorValue[resetLED];
		wait1Msec(1000);
	}
}

Add button driving and reset encoder warning when bot picked up


/*
 * Principal component analysis
 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/**
 * @file pca.h
 * Principal component analysis
 */

struct PCA *ff_pca_init(int n);
void ff_pca_free(struct PCA *pca);
void ff_pca_add(struct PCA *pca, double *v);
int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);

/*
 * Principal component analysis
 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/**
 * @file pca.h
 * Principal component analysis
 */

#ifndef FFMPEG_PCA_H
#define FFMPEG_PCA_H

struct PCA *ff_pca_init(int n);
void ff_pca_free(struct PCA *pca);
void ff_pca_add(struct PCA *pca, double *v);
int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);

#endif /* FFMPEG_PCA_H */

Make diego happy before he notices.

Make diego happy before he notices.

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@14810 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b


/*
    Config (Singleton), extends ofxXMLSettings
    Loads app configuration properties from xml file.
*/

#pragma once

#ifndef BBC_CONFIG
#define BBC_CONFIG

#include "XmlSettingsEx.h"

#define CONFIG_GET(_key, _attr, _def) bbc::utils::Config::instance()->getAttribute("config:"_key, _attr, _def)

namespace bbc {
	namespace utils {

        class Config : public XmlSettingsEx {

            public:
                static string data_file_path;

                static Config* instance(); // pointer to itself

                bool load_success;

            protected:
                Config(); // protected constuctor

        };

    }
}

#endif

/*
    Config (Singleton), extends ofxXMLSettings
    Loads app configuration properties from xml file.
*/

#pragma once

#ifndef BBC_CONFIG
#define BBC_CONFIG

#include "XmlSettingsEx.h"

#define CONFIG_GET(_key, _attr, _def) bbc::utils::Config::instance()->getAttribute("config:"_key, _attr, _def)

namespace bbc {
	namespace utils {

        class Config : public XmlSettingsEx {

            public:
                static string data_file_path;

                static Config* instance(); // pointer to itself

                bool load_success;

            protected:
                Config(); // hidden constuctor

        };

    }
}

#endif

Tweak to test commiting from submodule

Tweak to test commiting from submodule


//===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H

#include "llvm/InstrTypes.h"

//===----------------------------------------------------------------------===//
//                 Classes to represent Binary operators
//===----------------------------------------------------------------------===//
//
// All of these classes are subclasses of the BinaryOperator class...
//

class GenericBinaryInst : public BinaryOperator {
public:
  GenericBinaryInst(BinaryOps Opcode, Value *S1, Value *S2,
		    const std::string &Name = "")
    : BinaryOperator(Opcode, S1, S2, Name) {
  }
};

class SetCondInst : public BinaryOperator {
  BinaryOps OpType;
public:
  SetCondInst(BinaryOps opType, Value *S1, Value *S2,
	      const std::string &Name = "");

  // getInverseCondition - Return the inverse of the current condition opcode.
  // For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
  //
  BinaryOps getInverseCondition() const;
};

#endif

//===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H

#include "llvm/InstrTypes.h"

//===----------------------------------------------------------------------===//
//                 Classes to represent Binary operators
//===----------------------------------------------------------------------===//
//
// All of these classes are subclasses of the BinaryOperator class...
//

class GenericBinaryInst : public BinaryOperator {
public:
  GenericBinaryInst(BinaryOps Opcode, Value *S1, Value *S2,
		    const std::string &Name = "")
    : BinaryOperator(Opcode, S1, S2, Name) {
  }
};

class SetCondInst : public BinaryOperator {
  BinaryOps OpType;
public:
  SetCondInst(BinaryOps opType, Value *S1, Value *S2,
	      const std::string &Name = "");

  // getInverseCondition - Return the inverse of the current condition opcode.
  // For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
  //
  BinaryOps getInverseCondition() const;

  // Methods for support type inquiry through isa, cast, and dyn_cast:
  static inline bool classof(const SetCondInst *) { return true; }
  static inline bool classof(const Instruction *I) {
    return I->getOpcode() == SetEQ || I->getOpcode() == SetNE ||
           I->getOpcode() == SetLE || I->getOpcode() == SetGE ||
           I->getOpcode() == SetLT || I->getOpcode() == SetGT;
  }
  static inline bool classof(const Value *V) {
    return isa<Instruction>(V) && classof(cast<Instruction>(V));
  }
};

#endif

Implement classof for SetCondInst so that instcombine doesn't break on dyn_cast<SetCondInst>

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


#pragma once

#define TINYFORMAT_USE_VARIADIC_TEMPLATES

#ifdef __GNUC__
// Tinyformat has a number of non-annotated switch fallthrough cases
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif

#include "dependencies/tinyformat/tinyformat.h"

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include "library/strings.h"
namespace OpenApoc
{

template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
	return tfm::format(fmt.cStr(), std::forward<Args>(args)...);
}

UString tr(const UString &str, const UString domain = "ufo_string");

} // namespace OpenApoc

#pragma once

#include "fmt/printf.h"
#include "library/strings.h"

namespace OpenApoc
{

template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
	return fmt::sprintf(fmt.str(), std::forward<Args>(args)...);
}

UString tr(const UString &str, const UString domain = "ufo_string");

} // namespace OpenApoc

template <> struct fmt::formatter<OpenApoc::UString> : formatter<std::string>
{
	template <typename FormatContext> auto format(const OpenApoc::UString &s, FormatContext &ctx)
	{
		return formatter<std::string>::format(s.str(), ctx);
	}
};

Use fmtlib's sprintf instead of tinyformat

TODO: Move to the indexed formatting strings for fmtlib