Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Revert "[GeoCAD] Protect all of OpenCascade headers from declaring Printf." | // @(#)geom/geocad:$Id$
// Author: Cinzia Luzzi 5/5/2012
/*************************************************************************
* Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... | // @(#)geom/geocad:$Id$
// Author: Cinzia Luzzi 5/5/2012
/*************************************************************************
* Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... |
Add methods for detecting different kinds of files by their magic number, getting the suffix for shared objects, and extracting the basename from a path. | //===- llvm/System/Process.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Reid Spencer and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===------------------... | |
Add missing destructor bodies... oops | //===-- ModelSync.h - Wireless Syncing of GameModel ---------------- c++ --===//
//
// UWH Timer
//
// This file is distributed under the BSD 3-Clause License.
// See LICENSE.TXT for details.
//
//===-----------------------------------------------------------... | //===-- ModelSync.h - Wireless Syncing of GameModel ---------------- c++ --===//
//
// UWH Timer
//
// This file is distributed under the BSD 3-Clause License.
// See LICENSE.TXT for details.
//
//===-----------------------------------------------------------... |
Add comment for font list |
#ifndef _U8G2_FONTS_H
#define _U8G2_FONTS_H
#define U8G2_FONT_TABLE_ENTRY(font)
// ***************************************************************************
// Configure U8glib fonts
//
#ifndef U8G2_FONT_TABLE_EXTRA
//
// Add a U8G2_FONT_TABLE_ENTRY for each font you want to compile into the image
#define U8G2_FON... |
#ifndef _U8G2_FONTS_H
#define _U8G2_FONTS_H
#define U8G2_FONT_TABLE_ENTRY(font)
// ***************************************************************************
// Configure U8glib fonts
//
#ifndef U8G2_FONT_TABLE_EXTRA
//
// Add a U8G2_FONT_TABLE_ENTRY for each font you want to compile into the image
// See https://g... |
Fix typos in DEBUG_MSG and ERROR_MSG macros | #ifndef GVKILL_DEBUG_H
#define GVKILL_DEBUG_H
#include <cstdlib>
#include <iostream>
// FIXME: These need to be made Windows comptabile
#define DEBUG(X) if (getenv("GVKI_DEBUG") != NULL) X
#define DEBUG_MSG(X) DEBUG( std::cerr << "\033[32m***GVKILL:" << X << "***\033[0m" << std::endl)
// FIXME: This belongs in its o... | #ifndef GVKILL_DEBUG_H
#define GVKILL_DEBUG_H
#include <cstdlib>
#include <iostream>
// FIXME: These need to be made Windows comptabile
#define DEBUG(X) if (getenv("GVKI_DEBUG") != NULL) X
#define DEBUG_MSG(X) DEBUG( std::cerr << "\033[32m***GVKI:" << X << "***\033[0m" << std::endl)
// FIXME: This belongs in its own... |
Implement a minimalistic version for x86. | /* libunwind - a platform-independent unwind library
Copyright (C) 2002 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"... | |
Add a test rule to reset the FFF fakes | /* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "test_mocks.h"
DEFINE_FFF_GLOBALS;
/* Mocks for common/init_rom.c */
DEFINE_FAKE_VALUE_FUNC(const void *, init_rom_map, const void *, in... | /* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <ztest.h>
#include "test_mocks.h"
DEFINE_FFF_GLOBALS;
/* Mocks for common/init_rom.c */
DEFINE_FAKE_VALUE_FUNC(const void *, init_rom_m... |
Fix the constructor typo. The new type should follow PI spec. | /** @file
Internal Header file for PEI Services Table Pointer Library.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. 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 f... | /** @file
Internal Header file for PEI Services Table Pointer Library.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. 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 f... |
Add helper functions for state | //
// RTRNodeState.h
// Router
//
// Created by Nick Tymchenko on 14/09/15.
// Copyright (c) 2015 Pixty. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, RTRNodeState) {
RTRNodeStateNotInitialized = 0,
RTRNodeStateInactive = 1,
RTRNodeStateDeactivating = 2,
RTRN... | //
// RTRNodeState.h
// Router
//
// Created by Nick Tymchenko on 14/09/15.
// Copyright (c) 2015 Pixty. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, RTRNodeState) {
RTRNodeStateNotInitialized = 0,
RTRNodeStateInactive = 1,
RTRNodeStateDeactivating = 2,
RTRN... |
Add support for NPB classes. |
enum npb_class { S, W, A, B, C, D };
static const int NKEY_LOG2[] = { 16, 20, 23, 25, 27, 29 };
static const int MAX_KEY_LOG2[] = { 11, 16, 19, 21, 23, 27 };
static const int NBUCKET_LOG2[] = { 10, 10, 10, 10, 10, 10 };
inline npb_class get_npb_class(char c) {
switch (c) {
case 'S': re... | |
Add getters for branch and files. | #ifndef __PARSE_GIT_ST_H
#define __PARSE_GIT_ST_H
#include <vector>
#include <string>
const int PIPE_LINE_BUFFER_SIZE = 256;
class GitStatusParser {
std::vector<std::string*> pipe_buffer;
std::string* branch;
std::vector<std::string*> new_files;
std::vector<std::string*> modified_files;
std::vec... | #ifndef __PARSE_GIT_ST_H
#define __PARSE_GIT_ST_H
#include <vector>
#include <string>
const int PIPE_LINE_BUFFER_SIZE = 256;
class GitStatusParser {
std::vector<std::string*> pipe_buffer;
std::string* branch;
std::vector<std::string*> new_files;
std::vector<std::string*> modified_files;
std::vec... |
Test application was jumping to a wrong address. | #include "config.h"
#include <util/delay.h>
#include "usart.h"
void send_block(unsigned bytes, char *buff)
{
for(int i = 0; i < bytes; ++i)
{
usart_transmit(buff[i]);
}
}
int main(int argc, char **argv)
{
usart_init();
char msg[] = "Loading bootloader in 3 seconds.";
send_block(sizeo... | #include "config.h"
#include <util/delay.h>
#include "usart.h"
void send_block(unsigned bytes, char *buff)
{
for(int i = 0; i < bytes; ++i)
{
usart_transmit(buff[i]);
}
}
int main(int argc, char **argv)
{
usart_init();
char msg[] = "Loading bootloader in 3 seconds.";
send_block(sizeo... |
Add {c|r}{begin|end} since gcc doesnt know it. | #pragma once
namespace std {
template <typename T> auto cbegin(const T &c) { return c.cbegin(); }
template <typename T> auto crbegin(const T &c) { return c.crbegin(); }
template <typename T> auto cend(const T &c) { return c.cend(); }
template <typename T> auto crend(const T &c) { return c.crend(); }
}
| |
Fix a typo - this unbreaks llvm-gcc build on arm | //===-- llvm/Target/ARMTargetObjectFile.h - ARM Object Info -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===-- llvm/Target/ARMTargetObjectFile.h - ARM Object Info -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Add basic operation function declaration | #include <stdlib.h>
#ifndef __QUEUE_H__
#define __QUEUE_H__
struct Queue;
typedef struct Queue Queue;
#endif | #include <stdlib.h>
#ifndef __QUEUE_H__
#define __QUEUE_H__
struct Queue;
typedef struct Queue Queue;
Queue* Queue_Create(size_t n);
void Queue_Destroy(Queue* q);
void Queue_Enqueue(Queue* q, void* e);
void* Queue_Dequeue(Queue* q);
#endif |
Fix sparse warning about 1-bit signed bit-field | /*
* Driver for VIA PadLock
*
* Copyright (c) 2004 Michal Ludvig <michal@logix.cz>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
... | /*
* Driver for VIA PadLock
*
* Copyright (c) 2004 Michal Ludvig <michal@logix.cz>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
... |
DELETE USELESS CLASSES -ok that was fun | #ifndef GUI_COMPONENTS
#define GUI_COMPONENTS
void typewriterTextEffect() {
}
//reminder: use composition
//reminder: game will be played almost entirely through keyboard
class TextBox {
};
class ContextMenu {};
#endif
| #ifndef GUI_COMPONENTS
#define GUI_COMPONENTS
#endif
|
Update clock file from other repo | #include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <board_driver/uart.h>
#include <board_driver/rtc.h>
int main(void) {
uart_init();
printf("Starting\n\n");
printf("RTC status: %d\n", BSP_RTC_Init());
struct tm ti;
char month[3];
sscanf(__DATE__, "%s %d... | |
Use reset() to make optional empty | #pragma once
#include <memory>
#include <nonstd/optional.hpp>
#include "xchainer/array.h"
namespace xchainer {
class OpNode;
class ArrayNode {
public:
ArrayNode() = default;
const std::shared_ptr<OpNode>& next_node() { return next_node_; }
std::shared_ptr<const OpNode> next_node() const { return next... | #pragma once
#include <memory>
#include <nonstd/optional.hpp>
#include "xchainer/array.h"
namespace xchainer {
class OpNode;
class ArrayNode {
public:
ArrayNode() = default;
const std::shared_ptr<OpNode>& next_node() { return next_node_; }
std::shared_ptr<const OpNode> next_node() const { return next... |
Add user-defined constructor to the wfd::Driver class | /*
* This file is part of wysiwidi
*
* Copyright (C) 2014 Intel Corporation.
*
* 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 opt... | /*
* This file is part of wysiwidi
*
* Copyright (C) 2014 Intel Corporation.
*
* 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 opt... |
Synchronize the mailbox after expunging messages to actually get them expunged. | /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!... | /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!... |
Include stdio.h in case bzlib.h needs it. | /* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream-internal.h"
#include "istream-zlib.h"
#ifdef HAVE_BZLIB
#include <bzlib.h>
#define BZLIB_INCLUDE
#define gzFile BZFILE
#define gzdopen BZ2_bzdopen
#define gzclose BZ2_bzclose
#define gzread BZ2_bzread
#de... | /* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream-internal.h"
#include "istream-zlib.h"
#ifdef HAVE_BZLIB
#include <stdio.h>
#include <bzlib.h>
#define BZLIB_INCLUDE
#define gzFile BZFILE
#define gzdopen BZ2_bzdopen
#define gzclose BZ2_bzclose
#define gz... |
Update files, Alura, Introdução a C, Aula 2.9 | #include <stdio.h>
#define NUMERO_DE_TENTATIVAS 5
int main() {
// imprime o cabecalho do nosso jogo
printf("******************************************\n");
printf("* Bem vindo ao nosso jogo de adivinhação *\n");
printf("******************************************\n");
int numerosecreto = 42;
int chute;
... | #include <stdio.h>
#define NUMERO_DE_TENTATIVAS 5
int main() {
// imprime o cabecalho do nosso jogo
printf("******************************************\n");
printf("* Bem vindo ao nosso jogo de adivinhação *\n");
printf("******************************************\n");
int numerosecreto = 42;
int chute;
... |
Add nullable annotations to header | //
// JMAttributedFormat.h
// JMAttributedFormat
//
// Created by Jonathon Mah on 2015-04-11.
// This file is licensed under the MIT License. See LICENSE.txt for full details.
//
#import <Foundation/Foundation.h>
@interface NSObject (JMAttributedFormat_Optional)
- (NSAttributedString *)attributedDescription;
@en... | //
// JMAttributedFormat.h
// JMAttributedFormat
//
// Created by Jonathon Mah on 2015-04-11.
// This file is licensed under the MIT License. See LICENSE.txt for full details.
//
#import <Foundation/Foundation.h>
@interface NSObject (JMAttributedFormat_Optional)
- (nullable NSAttributedString *)attributedDescrip... |
Remove map not used anymore. | /*
* hooks.h
* StatusSpec project
*
* Copyright (c) 2014 thesupremecommander
* BSD 2-Clause License
* http://opensource.org/licenses/BSD-2-Clause
*
*/
#pragma once
#include "stdafx.h"
#include <map>
#define CLIENT_DLL
#define GLOWS_ENABLE
#include "cdll_int.h"
#include "KeyValues.h"
#include "igamer... | /*
* hooks.h
* StatusSpec project
*
* Copyright (c) 2014 thesupremecommander
* BSD 2-Clause License
* http://opensource.org/licenses/BSD-2-Clause
*
*/
#pragma once
#include "stdafx.h"
#include <map>
#define CLIENT_DLL
#define GLOWS_ENABLE
#include "cdll_int.h"
#include "KeyValues.h"
#include "igamer... |
Correct compillation for GCC apparently... | //PLEASE INCLUDE THIS FILE ON ANY ANNWVYN HEADER
/*This file conrain macro and symbols definition that have to be
* parsed by precompiler on each file.
* They handle diferencies between compilers
*/
//-------------------------DLL EXPORT -------------------------------//
//DLL management for visual studio compiller.
#... | //PLEASE INCLUDE THIS FILE ON ANY ANNWVYN HEADER
/*This file conrain macro and symbols definition that have to be
* parsed by precompiler on each file.
* They handle diferencies between compilers
*/
//-------------------------DLL EXPORT -------------------------------//
//DLL management for visual studio compiller.
#... |
Initialize all the global vars in the hope it will stop MacOS from complaining | #include <sys/types.h>
#include <stdint.h>
typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
typedef signed long sL;
typedef unsigned long uL;
typedef float f32;
typedef double f64;
typedef unsigned lo... | #include <sys/types.h>
#include <stdint.h>
typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
typedef signed long sL;
typedef unsigned long uL;
typedef float f32;
typedef double f64;
typedef unsigned lo... |
Document 2 FIXME's for an app-embedded LG library | /* There is no include guard here - by purpose. This file can be included
* after system includes that redefine the assert() macro.
* The actual problem for which this file got separated from utilities.h
* happens in the sat-solver code, when local include files include
* Solver.h which in turn includes the system'... | /* There is no include guard here - by purpose. This file can be included
* after system includes that redefine the assert() macro.
* The actual problem for which this file got separated from utilities.h
* happens in the sat-solver code, when local include files include
* Solver.h which in turn includes the system'... |
Update the zebra launcher to use chpl_launch_using_exec() as implemented in r18010. | #include <stdio.h>
#include <string.h>
#include "chpllaunch.h"
#include "chpl_mem.h"
#include "error.h"
static char* chpl_launch_create_command(int argc, char* argv[],
int32_t numLocales) {
int i;
int size;
char baseCommand[256];
char* command;
chpl_compute_real_bina... | #include <stdio.h>
#include <string.h>
#include "chpllaunch.h"
#include "chpl_mem.h"
#include "error.h"
static char** chpl_launch_create_argv(int argc, char* argv[]) {
const int largc = 3;
char *largv[largc];
largv[0] = (char *) "zebra";
largv[1] = (char *) "-fast";
largv[2] = (char *) "-r";
return chpl... |
Update to catch up with renames of internal structures. | /**
* 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... | /**
* 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... |
Make some sample blocks for merging | #include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include "base.h"
int main( int argc, char** argv ) {
srand( 23898645 );
uint16 blocks = 4;
uint64 elements = 128;
if( argc == 3 ) {
... | |
Add Drawing Kit header in general header | //
// iOSKit.h
// iOSKit
//
// Created by Yarik Smirnov on 1/23/12.
// Copyright (c) 2012 e-Legion ltd. All rights reserved.
//
#ifndef Elegion_iOSKit_h
#define Elegion_iOSKit_h
#import "ELIconView.h"
#import "ELInfoView.h"
#import "ELPickerView.h"
#import "ELSwipeController.h"
#endif
| //
// iOSKit.h
// iOSKit
//
// Created by Yarik Smirnov on 1/23/12.
// Copyright (c) 2012 e-Legion ltd. All rights reserved.
//
#ifndef Elegion_iOSKit_h
#define Elegion_iOSKit_h
#import "ELIconView.h"
#import "ELInfoView.h"
#import "ELPickerView.h"
#import "ELSwipeController.h"
#endif
|
Fix DEBUG_HIGHMEM build break from d4515646699 | #ifndef _ASM_POWERPC_KMAP_TYPES_H
#define _ASM_POWERPC_KMAP_TYPES_H
#ifdef __KERNEL__
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your opti... | #ifndef _ASM_POWERPC_KMAP_TYPES_H
#define _ASM_POWERPC_KMAP_TYPES_H
#ifdef __KERNEL__
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your opti... |
Move system header files to top in order to get rid of redefine warnings for Visual C++. | /* $Id$
Everything needed by the C demo programs.
Created to avoid junking up plplot.h with this stuff.
*/
#ifndef __PLCDEMOS_H__
#define __PLCDEMOS_H__
#include "plConfig.h"
#include "plplot.h"
#include <math.h>
#include <string.h>
#include <ctype.h>
/* define PI if not defined by math.h */
/* Actually M_PI see... | /* $Id$
Everything needed by the C demo programs.
Created to avoid junking up plplot.h with this stuff.
*/
#ifndef __PLCDEMOS_H__
#define __PLCDEMOS_H__
#include <math.h>
#include <string.h>
#include <ctype.h>
#include "plConfig.h"
#include "plplot.h"
/* define PI if not defined by math.h */
/* Actually M_PI se... |
Add typedefs for Point3f and Point3d | /******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit is free software: you can redistribute it and/or modify
** it under the ... | /******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit is free software: you can redistribute it and/or modify
** it under the ... |
Update a test to FileCheck. | // RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 1
// RUN: grep "ret i32 1" %t | count 1
// PR2001
/* Test that the result of the assignment properly uses the value *in
the bitfield* as opposed to the RHS. */
static int f... | // RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s
// PR2001
/* Test that the result of the assignment properly uses the value *in
the bitfield* as opposed to the RHS. */
static int foo(int i) {
struct {
int f0 : 2;
} x;
return (x.f0 = i);
}
int bar() {
// CHECK: ret i3... |
Check cplusplus in header files. | /*
* Open Chinese Convert
*
* Copyright 2010 BYVoid <byvoid1@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... | /*
* Open Chinese Convert
*
* Copyright 2010 BYVoid <byvoid1@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... |
Check that we don't warn on this testcase. This is basically a test that Decl::isUsed checks the attribute. If the function had a body just the check is DeclMustBeEmitted would be sufficient. | // RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
struct __attribute__((used)) s { // expected-warning {{'used' attribute on... | // RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
struct __attribute__((used)) s { // expected-warning {{'used' attribute on... |
Fix strerror_r on some esoteric platforms | #ifndef __HIREDIS_FMACRO_H
#define __HIREDIS_FMACRO_H
#if defined(__linux__)
#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#endif
#if defined(__sun__)
#define _POSIX_C_SOURCE 200112L
#elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE
#endif
#if... | #ifndef __HIREDIS_FMACRO_H
#define __HIREDIS_FMACRO_H
#if defined(__linux__)
#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#endif
#if defined(__sun__)
#define _POSIX_C_SOURCE 200112L
#else
#define _XOPEN_SOURCE 600
#endif
#if __APPLE__ && __MACH__
#define _OSX
#endif
#endif
|
Fix "assignment operator could not be generated" warning | #ifndef UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H
#define UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H
#include "HelperMacros.h"
#include "ThrowingTestReporter.h"
namespace UnitTest {
class TestResults;
// This RAII class decorates the current TestReporter with
// a version that throws after reporting a failure.
... | #ifndef UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H
#define UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H
#include "HelperMacros.h"
#include "ThrowingTestReporter.h"
namespace UnitTest {
class TestResults;
// This RAII class decorates the current TestReporter with
// a version that throws after reporting a failure.
... |
Add heap sort in C | #include<stdio.h>
void create(int []);
void down_adjust(int [],int);
void main()
{
int heap[30],n,i,last,temp;
printf("Enter no. of elements:");
scanf("%d",&n);
printf("\nEnter elements:");
for(i=1;i<=n;i++)
scanf("%d",&heap[i]);
//create a heap
heap[0]=n;
create(heap);
//sorting
while(heap[0] > 1)
... | |
Rewrite recursion test to calculate Fibonacci | /**
* @file
* @brief tests proper stack usage (particularly, right handling
* of window overflow/underflow on SPARC).
*
* @date 14.08.09
* @author Eldar Abusalimov
*/
#include <embox/test.h>
#include <test/misc.h>
#define RECURSION_DEPTH 32
EMBOX_TEST(run);
static int run(void) {
return test_misc_recursion(... | /**
* @file
* @brief Tests proper stack usage.
*
* @date 14.08.09
* @author Eldar Abusalimov
*/
#include <embox/test.h>
#include <test/misc.h>
EMBOX_TEST_SUITE("Stack usage tests");
static int fib(int k) {
if (k < 2) {
return k;
} else {
return fib(k - 1) + fib(k - 2);
}
}
TEST_CASE("Recursively calcul... |
Use GtkDialog, not GnomeDialog. (GnomeAbout, GnomeAbout): Derive from | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* gnome-window.h: wrappers for setting window properties
*
* Author: Chema Celorio <chema@celorio.com>
*/
/*
* These functions are a convenience wrapper for gtk_window_set_title
* This allows all the gnome-apps to have a consitent wa... | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* gnome-window.h: wrappers for setting window properties
*
* Author: Chema Celorio <chema@celorio.com>
*/
/*
* These functions are a convenience wrapper for gtk_window_set_title
* This allows all the gnome-apps to have a consitent wa... |
Fix _LZO_H vs. LZO_H typo | /*
* LZO 1x decompression
* copyright (c) 2006 Reimar Doeffinger
*
* This file is part of FFmpeg.
*
* FFmpeg 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,... | /*
* LZO 1x decompression
* copyright (c) 2006 Reimar Doeffinger
*
* This file is part of FFmpeg.
*
* FFmpeg 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,... |
Use __inline to fix MSVC build. | /**************************************************************************
*
* Copyright 2016 Jose Fonseca
* All Rights Reserved.
*
* 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 wit... | /**************************************************************************
*
* Copyright 2016 Jose Fonseca
* All Rights Reserved.
*
* 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 wit... |
Add Nonmovable inheritance to Model. | #ifndef PRIMITIV_MODEL_H_
#define PRIMITIV_MODEL_H_
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
namespace primitiv {
class Parameter;
/**
* Set of parameters and specific algorithms.
*/
class Model {
Model(const Model &) = delete;
Model &operator=(const Model &) = del... | #ifndef PRIMITIV_MODEL_H_
#define PRIMITIV_MODEL_H_
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <primitiv/mixins.h>
namespace primitiv {
class Parameter;
/**
* Set of parameters and specific algorithms.
*/
class Model : mixins::Nonmovable<Model> {
public:
Mode... |
UPDATE Lever entity sync state | #ifndef SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#define SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#include "Entity.h"
struct LeverSyncState {
};
class LeverEntity :
public Entity
{
private:
//Variables
bool m_isActive;
float m_range;
public:
LeverEntity();
virtual ~LeverEntity();
int Initialize(int entityID, Physi... | #ifndef SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#define SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#include "Entity.h"
struct LeverSyncState {
int entityID;
bool iActive;
};
class LeverEntity :
public Entity
{
private:
//Variables
bool m_isActive;
float m_range;
bool m_needSync;
public:
LeverEntity();
virtual ~Lev... |
Add Uefi Capsule Definition header file. | /** @file
Defines for the EFI Capsule functionality.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of t... | |
Include typeinfo header for RTTI | #ifndef APIMOCK_IOC_H
#define APIMOCK_IOC_H
#include <unordered_map>
#include <string>
namespace ApiMock {
class ServiceRegistry {
static std::unordered_map<std::string, void*> container;
public:
template<typename T>
static void Register(T* object) {
container[typeid(T).name()] = reinterpret_cast<void*>(... | #ifndef APIMOCK_IOC_H
#define APIMOCK_IOC_H
#include <unordered_map>
#include <typeinfo>
#include <string>
namespace ApiMock {
class ServiceRegistry {
static std::unordered_map<std::string, void*> container;
public:
template<typename T>
static void Register(T* object) {
container[typeid(T).name()] = rein... |
Add uninitialized values test case. | // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s
struct s {
int data;
};
struct s global;
void g(int);
void f4() {
int a;
if (global.data == 0)
a = 3;
if (global.data == 0) // When the true branch is feasible 'a = 3'.
g(a); // no-warning
}
| // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s
struct s {
int data;
};
struct s global;
void g(int);
void f4() {
int a;
if (global.data == 0)
a = 3;
if (global.data == 0) // When the true branch is feasible 'a = 3'.
g(a); // no-warning
}
// Test uninitialized value due ... |
Use an unsigned long for non-negative longs. | #ifndef MONSOON_METRIC_VALUE_INL_H
#define MONSOON_METRIC_VALUE_INL_H
#include <utility>
namespace monsoon {
inline metric_value::metric_value(metric_value&& other) noexcept
: value_(std::move(other.value_))
{}
inline auto metric_value::operator=(metric_value&& other) noexcept
-> metric_value& {
value_ = std::m... | #ifndef MONSOON_METRIC_VALUE_INL_H
#define MONSOON_METRIC_VALUE_INL_H
#include <utility>
namespace monsoon {
inline metric_value::metric_value(metric_value&& other) noexcept
: value_(std::move(other.value_))
{}
inline auto metric_value::operator=(metric_value&& other) noexcept
-> metric_value& {
value_ = std::m... |
Fix analyzer warning that title is not read | // Part of FoundationKit http://foundationk.it
#import <mach/mach_time.h>
#import "FKInternal.h"
/**
If we are in Debug-Mode this functions benchmarks the given block and logs
information about it's duration. Otherwise the block is just executed.
@param title the name of the benchmark
@param block the block to ... | // Part of FoundationKit http://foundationk.it
#import <mach/mach_time.h>
#import "FKInternal.h"
/**
If we are in Debug-Mode this functions benchmarks the given block and logs
information about it's duration. Otherwise the block is just executed.
@param title the name of the benchmark
@param block the block to ... |
Add a little header explaining the purpose of phase-01 | #include <stdlib.h>
int main(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
| /**
* Phase 01 - Get a Window that works and can be closed.
*
* This code won't be structured very well, just trying to get stuff working.
*/
#include <stdlib.h>
int main(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
|
Check in new macro vappend()- not actually used | /*
* tools.h
*
* Created on: May 4, 2011
* Author: wozniak
*/
#ifndef TOOLS_H
#define TOOLS_H
/**
Determine the length of an array of pointers
*/
int array_length(void** array);
#define append(string, args...) string += sprintf(string, ## args)
#endif /* TOOLS_H_ */
| /*
* tools.h
*
* Created on: May 4, 2011
* Author: wozniak
*/
#ifndef TOOLS_H
#define TOOLS_H
/**
Determine the length of an array of pointers
*/
int array_length(void** array);
#define append(string, args...) string += sprintf(string, ## args)
#define vappend(string, args...) string += vsprintf(stri... |
Add edge weights to side calculations | #ifndef ENGPAR_SIDES_H
#define ENGPAR_SIDES_H
#include <ngraph.h>
#include <PCU.h>
#include "engpar_container.h"
#include <engpar_metrics.h>
#include "engpar_diffusive_input.h"
namespace engpar {
class Sides : public Container<int> {
public:
Sides(agi::Ngraph* g, agi::etype t) {
agi::Ngraph* graph = g;... | #ifndef ENGPAR_SIDES_H
#define ENGPAR_SIDES_H
#include <ngraph.h>
#include <PCU.h>
#include "engpar_container.h"
#include <engpar_metrics.h>
#include "engpar_diffusive_input.h"
namespace engpar {
class Sides : public Container<int> {
public:
Sides(agi::Ngraph* g, agi::etype t) {
agi::Ngraph* graph = g;... |
Fix clang build that have been broken by 81364. | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#include "base/basictyp... | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#include "base/basictyp... |
Fix implied ms_abi where it shouldn't be | #pragma once
#include <cstdio>
// HACK: No idea where this should actually be defined
#define nullptr 0x0
#pragma GCC diagnostic ignored "-Wattributes"
#include "openvr.h"
#pragma GCC diagnostic warning "-Wattributes"
using namespace vr;
#ifdef __x86_64__
// MS instead of SysV ABI for 64bit
#define WOVR_ENTRY __attr... | #pragma once
#include <cstdio>
// HACK: No idea where this should actually be defined
#define nullptr 0x0
// If _WIN32 is defined, openvr.h will decorate the exported functions with __declspec(dllimport) which implies
// __attribute__((ms_abi)). This makes things explode, as we need to call them with SysV ABI.
#undef... |
Add some allocator constants like minimum alignment or maximum small size. | // Copyright (c) 2012-2013, the scalloc Project Authors. All rights reserved.
// Please see the AUTHORS file for details. Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.
#ifndef SCALLOC_COMMON_H_
#define SCALLOC_COMMON_H_
#include <stddef.h> // size_t
#include "confi... | // Copyright (c) 2012-2013, the scalloc Project Authors. All rights reserved.
// Please see the AUTHORS file for details. Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.
#ifndef SCALLOC_COMMON_H_
#define SCALLOC_COMMON_H_
#include <stddef.h> // size_t
#include "confi... |
Add comment regarding mixed content preprocessor | //
// AshtonObjcMixedContentPreprocessor.h
// Ashton
//
// Created by Michael Schwarz on 15.01.18.
// Copyright © 2018 Michael Schwarz. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AshtonObjcMixedContentPreprocessor: NSObject
- (NSString *)preprocessHTMLString:(N... | //
// AshtonObjcMixedContentPreprocessor.h
// Ashton
//
// Created by Michael Schwarz on 15.01.18.
// Copyright © 2018 Michael Schwarz. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// TBXML parser cannot handle html mixed content, therefore we have to preprocess it
/// mixe... |
Add a facility to concatenate preprocessor strings. | /*!
* This file defines an interface to fold preprocessor strings into one token.
*
* @author Louis Dionne
*/
#ifndef JOY_INTERNAL_STRCAT_H
#define JOY_INTERNAL_STRCAT_H
#include <chaos/preprocessor/recursion/expr.h>
#include <chaos/preprocessor/algorithm/fold_right.h>
#include <chaos/preprocessor/string/core.h>
... | |
Add include for smmintrin.h to this test. | // RUN: %clang -fsyntax-only %s
// RUN: %clang -fsyntax-only -fno-lax-vector-conversions %s
// RUN: %clang -fsyntax-only -x c++ %s
#if defined(i386) || defined(__x86_64__)
# if defined(__MMX__)
#include <emmintrin.h>
#include <mm_malloc.h>
# endif
# if defined(__SSE__)
#include <xmmintrin.h>
# endif
# if defin... | // RUN: %clang -fsyntax-only %s
// RUN: %clang -fsyntax-only -fno-lax-vector-conversions %s
// RUN: %clang -fsyntax-only -x c++ %s
#if defined(i386) || defined(__x86_64__)
# if defined(__MMX__)
#include <emmintrin.h>
#include <mm_malloc.h>
# endif
# if defined(__SSE__)
#include <xmmintrin.h>
# endif
# if defin... |
Fix for complex reference on Mac. | #include "v3p_f2c.h"
#ifdef KR_headers
extern double sqrt(), f__cabs();
VOID c_sqrt(r, z) complex *r, *z;
#else
#undef abs
#include "math.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double f__cabs(double, double);
void c_sqrt(complex *r, complex *z)
#endif
{
double mag, t;
double zi = z->i, zr =... | #include "v3p_f2c.h"
#ifdef KR_headers
extern double sqrt(), f__cabs();
VOID c_sqrt(r, z) complex *r, *z;
#else
#undef abs
#include "math.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double f__cabs(double, double);
#undef complex
#define complex v3p_netlib_complex
void c_sqrt(complex *r, complex *z)
#endif
{
... |
Improve name AT_ARG changed to AT_TYPE | #ifndef SIMPLEAT_H
#define SIMPLEAT_H
#include <stdint.h>
#define AT_MAX_NUMBER_OF_ARGS 4
#define CLIENT_FUNCTION_TYPE uint16_t
#define ECHO_MODE_ON 1
#define AT_NO_ARGS {0}
#define AT_ARGS(...) {__VA_ARGS__, -1}
#define AT_ARG(x) ((uint8_t) sizeof (x))
#define AT_COMMAND(name, args, client) {(char*)#name, 0, args , ... | #ifndef SIMPLEAT_H
#define SIMPLEAT_H
#include <stdint.h>
#define AT_MAX_NUMBER_OF_ARGS 4
#define CLIENT_FUNCTION_TYPE uint16_t
#define ECHO_MODE_ON 1
#define AT_NO_ARGS {0}
#define AT_ARGS(...) {__VA_ARGS__, -1}
#define AT_TYPE(x) ((uint8_t) sizeof (x))
#define AT_COMMAND(name, args, client) {(char*)#name, 0, args ,... |
Correct previous merge with master | /*
* Copyright 2016, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __PLAT_MACHINE_HARDWARE_H
#define __PLAT... | /*
* Copyright 2016, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __PLAT_MACHINE_HARDWARE_H
#define __PLAT... |
Add a header w/ macro to suppress unsigned integer UBSan warnings. | /*
* Copyright 2021 Scott Vokes
*
* See LICENCE for the full copyright terms.
*/
#ifndef LIBFSM_COMMON_H
#define LIBFSM_COMMON_H
#if defined(__clang__)
/* Newer versions of clang's UBSan emit warnings about *all* unsigned
* integer overflows. While they are defined behavior, overflow can
* cause bugs. This macr... | |
Add WM8350 watchdog register definitions | /*
* wdt.h -- Watchdog Driver for Wolfson WM8350 PMIC
*
* Copyright 2007 Wolfson Microelectronics PLC
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the ... | |
Remove __restrict when not supported -Erik |
#ifndef __FEATURES_H
#define __FEATURES_H
/* Major and minor version number of the uCLibc library package. Use
these macros to test for features in specific releases. */
#define __UCLIBC__ 0
#define __UCLIBC_MAJOR__ 9
#define __UCLIBC_MINOR__ 1
#ifdef __STDC__
#define __P(x) x
#define __const const
/* Almo... |
#ifndef __FEATURES_H
#define __FEATURES_H
/* Major and minor version number of the uCLibc library package. Use
these macros to test for features in specific releases. */
#define __UCLIBC__ 0
#define __UCLIBC_MAJOR__ 9
#define __UCLIBC_MINOR__ 1
/* __restrict is known in EGCS 1.2 and above. */
#if !defined __G... |
Add more common __VERIFIER functions | void __VERIFIER_error() { abort(); }
int __VERIFIER_nondet_int() { int val; return val; } | void __VERIFIER_error() { abort(); }
// Some files define __VERIFIER_assume, some declare as extern. What happens when redefined?
void __VERIFIER_assume(int expression) { if (!expression) { LOOP: goto LOOP; }; return; }
// #define __VERIFIER_nondet(X) X __VERIFIER_nondet_##X() { X val; return val; }
#define __VERIFIE... |
Use a valid option (-msse) for testing QA_OVERRIDE_GCC3_OPTIONS. | // RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-### " %clang -target x86_64-apple-darwin %s -O2 b -O3 2>&1 | FileCheck %s
// RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-mfoo" %clang -target x86_64-apple-darwin -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR
... | // RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-### " %clang -target x86_64-apple-darwin %s -O2 b -O3 2>&1 | FileCheck %s
// RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-msse" %clang -target x86_64-apple-darwin -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR
... |
Fix PPC failure. Adjust CHECK pattern. | // Test that function entry counts are set correctly.
// RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata
// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s
void foo(void);
// CHECK: define void @foo() #0 !prof [[FOO:![0-9]+]]
void foo... | // Test that function entry counts are set correctly.
// RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata
// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s
void foo(void);
// CHECK: @foo() #0 !prof [[FOO:![0-9]+]]
void foo() { return;... |
Complete the rename of LHASH functions and types | /*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/lice... | /*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/lice... |
Add seven segment control code for debugging | #ifndef __SSEG_H
#define __SSEG_H
// aaa
// f b
// ggg
// e c
// ddd
const int kSegA = 1;
const int kSegB = 2;
const int kSegC = 4;
const int kSegD = 8;
const int kSegE = 16;
const int kSegF = 32;
const int kSegG = 64;
static char digits[] = {
~(kSegA | kSegB | kSegC | kSegD | kSegE | kSegF), // 0
~(kSegB | k... | |
Add skeleton for demuxer modules | /* *
* $Id$
*
* This file is part of Fenice
*
* Fenice -- Open Media Server
*
* Copyright (C) 2007 by
* - Dario Gallucci <dario.gallucci@polito.it>
*
* Fenice is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the ... | |
Update project to Xcode 11 beta 7 | //
// EZForm
//
// Copyright 2011-2013 Chris Miles. All rights reserved.
//
// 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 right... | //
// EZForm
//
// Copyright 2011-2013 Chris Miles. All rights reserved.
//
// 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 right... |
Solve Euler problem 44 on min. pentagon numbers. | // Copyright 2018 Dennis Decker Jensen
// Date: 29 April 2018
// Purpose: Minimum difference of pentagon numbers.
// Tectonics: cc -std=c11 -pedantic -Wall -O2 -o euler044 euler044.c
//
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
enum { npentagons = 10000 }; // N.B! Trial and error
unsigned pentagon[np... | |
Check user address explicitly in copy_from_user_nmi() | /*
* User address space access functions.
*
* For licencing details see kernel-base/COPYING
*/
#include <linux/highmem.h>
#include <linux/module.h>
#include <asm/word-at-a-time.h>
/*
* best effort, GUP based copy_from_user() that is NMI-safe
*/
unsigned long
copy_from_user_nmi(void *to, const void __user *fro... | /*
* User address space access functions.
*
* For licencing details see kernel-base/COPYING
*/
#include <linux/highmem.h>
#include <linux/module.h>
#include <asm/word-at-a-time.h>
#include <linux/sched.h>
/*
* best effort, GUP based copy_from_user() that is NMI-safe
*/
unsigned long
copy_from_user_nmi(void *t... |
Add short hand for help command | #include "commands.h"
#include <stdbool.h>
#include <stdio.h>
#include "util.h"
static const char* quit_matches[] = {"quit"};
static const char* help_matches[] = {"help"};
static void print_commands_help() {
puts(" Commands available:\n");
puts(" :quit \tExit laco");
puts(" :help \tDisplay this lis... | #include "commands.h"
#include <stdbool.h>
#include <stdio.h>
#include "util.h"
static const char* quit_matches[] = {"quit"};
static const char* help_matches[] = {"help", "?"};
static void print_commands_help() {
puts(" Commands available:\n");
puts(" :quit \tExit laco");
puts(" :help, :? \tDispl... |
Add imports in main library header | //
// TATLayout.h
// TATLayout
//
// An expressive, simple yet poweful way for coding layout constraints in iOS.
//
// Copyright (c) 2014 Claudio Romandini.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), t... | //
// TATLayout.h
// TATLayout
//
// An expressive, simple yet poweful way for coding layout constraints in iOS.
//
// Copyright (c) 2014 Claudio Romandini.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), t... |
Fix for no cuda environment | #ifndef INCLUDE_GUARD_CUPY_CUDA_THRUST_H
#define INCLUDE_GUARD_CUPY_CUDA_THRUST_H
#ifndef CUPY_NO_CUDA
namespace cupy {
namespace thrust {
template <typename T>
void _sort(void *, size_t *, const std::vector<ptrdiff_t>&, size_t, void *);
template <typename T>
void _lexsort(size_t *, void *, size_t, size_t, size_t,... | #ifndef INCLUDE_GUARD_CUPY_CUDA_THRUST_H
#define INCLUDE_GUARD_CUPY_CUDA_THRUST_H
#ifndef CUPY_NO_CUDA
namespace cupy {
namespace thrust {
template <typename T>
void _sort(void *, size_t *, const std::vector<ptrdiff_t>&, size_t, void *);
template <typename T>
void _lexsort(size_t *, void *, size_t, size_t, size_t,... |
Add an add_member method for adding members. Change visibility of everything. | #ifndef CONFIG_CLASS_H
#define CONFIG_CLASS_H
#include <map>
class Config;
class ConfigObject;
class ConfigType;
class ConfigValue;
class ConfigClass {
friend class Config;
std::string name_;
std::map<std::string, ConfigType *> members_;
protected:
ConfigClass(const std::string& name)
: name_(name),
members... | #ifndef CONFIG_CLASS_H
#define CONFIG_CLASS_H
#include <map>
class Config;
class ConfigObject;
class ConfigType;
class ConfigValue;
class ConfigClass {
friend class Config;
std::string name_;
std::map<std::string, ConfigType *> members_;
protected:
ConfigClass(const std::string& name)
: name_(name),
members... |
Remove chipselect member - not needed | /*
High_Temp.h
2014 Copyright (c) Seeed Technology Inc. All right reserved.
Loovee
2013-4-14
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 Lice... | /*
High_Temp.h
2014 Copyright (c) Seeed Technology Inc. All right reserved.
Loovee
2013-4-14
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 Lice... |
Remove texts for understanding to Wiki pages | #ifndef GPIOLIB_H
#define GPIOLIB_H
#define FORWARD 1
#define BACKWARD 0
namespace GPIO
{
int init();
int controlLeft(int direction,int speed);
int controlRight(int direction,int speed);
int stopLeft();
int stopRight();
int resetCounter();
void getCounter(int *countLeft,int *countRight);
int turnTo(int an... | #ifndef GPIOLIB_H
#define GPIOLIB_H
#define FORWARD 1
#define BACKWARD 0
namespace GPIO
{
int init();
int controlLeft(int direction,int speed);
int controlRight(int direction,int speed);
int stopLeft();
int stopRight();
int resetCounter();
void getCounter(int *countLeft,int *countRight);
int turnTo(int ... |
Work around undocumented feature/bug in perlapi function is_utf8_string() by short-circuiting StrHelp_utf8_valid() to return true when the length of the string is 0. | /* 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... | /* 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... |
Add missing property for WebUtils mock | /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* This Source Code Form is subject to the terms of the Mozilla Pu... | /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* This Source Code Form is subject to the terms of the Mozilla Pu... |
Add helper program to lookup C constants | #include <fcntl.h>
#include <stdio.h>
int
main(void)
{
printf("F_GETFL=%d\n", F_GETFL);
printf("F_SETFL=%d\n", F_SETFL);
printf("O_NONBLOCK=%d\n", O_NONBLOCK);
return 0;
}
| |
Add a small test program for century_offset(), passes. | #include "decode_time.h"
#include <stdio.h>
int
main(int argc, char *argv[])
{
/* start with 2000-01-01 = Saturday (matches `ncal 2000`) */
uint8_t century, lday, co;
struct tm time;
time.tm_wday = 6; /* Saturday */
/* check for every date if it matches */
for (century = 0; century < 4; century++)
for (time.... | |
Use iopoll instead of poll directly. | #include <errno.h>
#include <sys/poll.h>
#include "iobuf.h"
int iobuf_timeout(iobuf* io, int poll_out)
{
struct pollfd pfd;
int result;
if (!io->timeout) return 1;
pfd.fd = io->fd;
pfd.events = poll_out ? POLLOUT : POLLIN;
while ((result = poll(&pfd, 1, io->timeout)) == -1) {
if (errno == EAGAIN) c... | #include <errno.h>
#include "iobuf.h"
#include "iopoll.h"
int iobuf_timeout(iobuf* io, int poll_out)
{
iopoll_fd pfd;
int result;
if (!io->timeout) return 1;
pfd.fd = io->fd;
pfd.events = poll_out ? IOPOLL_WRITE : IOPOLL_READ;
while ((result = iopoll(&pfd, 1, io->timeout)) == -1) {
if (errno == EAG... |
Fix export macro for non-MS compilers | ///////////////////////////////////////////////////////////////////////////////
// This source file is part of Zeroth.
//
// Copyright (c) 2016 Colin Hill
//
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <Hect/Core/Export.h>
#ifdef HECT_WINDOWS_BUILD
#ifdef ZER... | ///////////////////////////////////////////////////////////////////////////////
// This source file is part of Zeroth.
//
// Copyright (c) 2016 Colin Hill
//
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <Hect/Core/Export.h>
#ifdef HECT_WINDOWS_BUILD
#ifdef ZER... |
Switch HDC1000 to file descriptor design | /* @author: Samuel G samuel.genois@mail.mcgill.ca
Modification Log:
Date Author Modification
-----------------------------------------------------------------
31-Oct-2018 Samuel G Created the file
===============================================================... | /* @author: Samuel G samuel.genois@mail.mcgill.ca
Modification Log:
Date Author Modification
-----------------------------------------------------------------
31-Oct-2018 Samuel G Created the file
07-Nov-2018 Matthew L-K Switch to file de... |
Remove attribute ignored by compiler | #pragma once
#include <truth/cpu.h>
#include <truth/types.h>
#include <truth/log.h>
#define Not_Reached false
#define assert(x) \
if (!(x)) { \
logf("Assertion failed: (%s) function %s, file %s, line %d.", \
(#x), __func__, __FILE__, __LINE__); \
panic(); \
}
#define assert_ok(x... | #pragma once
#include <truth/cpu.h>
#include <truth/types.h>
#include <truth/log.h>
#define Not_Reached false
#define assert(x) \
if (!(x)) { \
logf("Assertion failed: (%s) function %s, file %s, line %d.", \
(#x), __func__, __FILE__, __LINE__); \
panic(); \
}
#define assert_ok(x... |
Remove exception handling before loading pgo sample profile data | // Test if PGO sample use passes are invoked.
//
// Ensure Pass PGOInstrumentationGenPass is invoked.
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s
// CHECK: Remove unused exception handling info
// CHECK: Sample profile pass
| // Test if PGO sample use passes are invoked.
//
// Ensure Pass PGOInstrumentationGenPass is invoked.
// RUN: %clang_cc1 -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=LEGACY
// RUN: %clang_cc1 -O2 ... |
Include maxdispargs.h instead of defs.h. | #include <netinet/in.h>
#include "defs.h" /* for MAXDISPARGS */
#define MAXTEXTARGS ((MAXDISPARGS*sizeof(double))/512)
#define MYPORT (IPPORT_RESERVED + 78)
/* IPPORT_RESERVED is 1024, so this is socket 1102
IPPORT_MAXPORT is 65535 on SGIs */
typedef struct sockdata {
char name[100]; /* the cmix command name *... | #include <netinet/in.h>
#include "maxdispargs.h"
#define MAXTEXTARGS ((MAXDISPARGS*sizeof(double))/512)
#define MYPORT (IPPORT_RESERVED + 78)
/* IPPORT_RESERVED is 1024, so this is socket 1102
IPPORT_MAXPORT is 65535 on SGIs */
typedef struct sockdata {
char name[100]; /* the cmix command name */
union {
... |
Add functions to perform simple approximate inference | #ifndef GRIDINF_INCLUDE_ESTIMATORS_H
#define GRIDINF_INCLUDE_ESTIMATORS_H
#include "core.h"
namespace ginf {
// Find the labeling where every node chooses the label that minimizes the data cost
template <typename T>
void decodeMaxPrior(Grid<T> *grid, Matrix<int> *result) {
for (int y = 0; y < grid->getHeight(); ... | |
Remove gen from loadable code | #include "csdl.h"
#include <math.h>
void tanhtable(FUNC *ftp, FGDATA *ff)
{
MYFLT *fp = ftp->ftable;
MYFLT range = ff->e.p[5];
double step = (double)range/(ff->e.p[3]);
int i;
double x;
for (i=0, x=FL(0.0); i<ff->e.p[3]; i++, x+=step)
*fp++ = (MYFLT)tanh(x);
}
static void gentune(FUNC *f... | #include "csdl.h"
#include <math.h>
void tanhtable(FUNC *ftp, FGDATA *ff)
{
MYFLT *fp = ftp->ftable;
MYFLT range = ff->e.p[5];
double step = (double)range/(ff->e.p[3]);
int i;
double x;
for (i=0, x=FL(0.0); i<ff->e.p[3]; i++, x+=step)
*fp++ = (MYFLT)tanh(x);
}
static NGFENS localfgens[]... |
Fix a couple typos in the CHECK macros. | // Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0`
#ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
#define OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
#include <stdbool.h>
#include "sw/device/lib/base/log.h"
#include "s... | // Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0`
#ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
#define OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
#include <stdbool.h>
#include "sw/device/lib/base/log.h"
#include "s... |
Fix implicit conversion warning when building with floating point Lua | /**
* \file string_hash.c
* \brief Computes a hash value for a string.
* \author Copyright (c) 2012-2014 Jason Perkins and the Premake project
*/
#include "premake.h"
#include <string.h>
int string_hash(lua_State* L)
{
const char* str = luaL_checkstring(L, 1);
unsigned long seed = luaL_optint(L, 2, 0);
lua... | /**
* \file string_hash.c
* \brief Computes a hash value for a string.
* \author Copyright (c) 2012-2014 Jason Perkins and the Premake project
*/
#include "premake.h"
#include <string.h>
int string_hash(lua_State* L)
{
const char* str = luaL_checkstring(L, 1);
unsigned long seed = luaL_optint(L, 2, 0);
lua... |
Add forward declarations for ansilove_ctx and ansilove_options structs. | /*
* types.h
* Ansilove 4.1.0
* https://www.ansilove.org
*
* Copyright (c) 2011-2020 Stefan Vogt, Brian Cassidy, and Frederic Cambus
* All rights reserved.
*
* Ansilove is licensed under the BSD 2-Clause License.
* See LICENSE file for details.
*/
#ifndef TYPES_H
#define TYPES_H
#define ANSILOVE_FILETYPE_AN... | /*
* types.h
* Ansilove 4.1.0
* https://www.ansilove.org
*
* Copyright (c) 2011-2020 Stefan Vogt, Brian Cassidy, and Frederic Cambus
* All rights reserved.
*
* Ansilove is licensed under the BSD 2-Clause License.
* See LICENSE file for details.
*/
#ifndef TYPES_H
#define TYPES_H
#define ANSILOVE_FILETYPE_AN... |
Make it explicit that the 'end' in a range [start, end[ is _not_ inclusive. | #ifndef EFDL_RANGE_H
#define EFDL_RANGE_H
#include <QPair>
#include <QDebug>
namespace efdl {
typedef QPair<qint64, qint64> Range; // (start, end)
}
QDebug operator<<(QDebug dbg, const efdl::Range &r);
#endif // EFDL_RANGE_H
| #ifndef EFDL_RANGE_H
#define EFDL_RANGE_H
#include <QPair>
#include <QDebug>
namespace efdl {
/**
* Encapsulates a file data range of the form [start, end[
*
* Note that "end" is not inclusive!
*/
typedef QPair<qint64, qint64> Range;
}
QDebug operator<<(QDebug dbg, const efdl::Range &r);
#endif // E... |
Add idle multiprocess system test. | /*
* kinetic-c
* Copyright (C) 2014 Seagate Technology.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This progr... | |
Include the no-buffer length when testing this function. | #include <string.h>
#include "number.h"
/** Format padding for a signed number. */
unsigned fmt_sign_pad(char* buffer, int sign, unsigned width, char pad)
{
char* s = buffer;
if (buffer == 0)
return width + (sign != 0);
if (!width) {
if (sign)
*s++ = '-';
}
else {
if (pad != '0') {
me... | #include <string.h>
#include "number.h"
/** Format padding for a signed number. */
unsigned fmt_sign_pad(char* buffer, int sign, unsigned width, char pad)
{
char* s = buffer;
if (buffer == 0)
return width + (sign != 0);
if (!width) {
if (sign)
*s++ = '-';
}
else {
if (pad != '0') {
me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.