Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Make a program that is incrementing a variable with number based on user input using the following data: If user inputs - increments with : 1 - 5 2 - 9 3 - 18 4 - 34 5 - 59 6 - 95 | #include <stdio.h>
#include <math.h>
int main()
{
int userInput = 0;
unsigned long number = 0;
while(1)
{
printf("Please enter a number between 1 and 6:");
scanf("%d", &userInput);
unsigned long incrementor = 0;
switch(userInput)
{
case 1:
inc... | |
Remove duplicate content in file. | // Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once
#ifdef BUILDING_CEF_SHARED
#include "base/m... | // Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once
#ifdef BUILDING_CEF_SHARED
#include "base/m... |
Add declaration and stubs for rotations | #include <stdlib.h>
#include "avl.h"
/*
*
*
* forward declarations
*
*
*/
static void
destroy_subtree(
struct avl_el* node //!< A node to destroy
);
/*
*
*
* interface implementation
*
*
*/
struct avl*
avl_alloc(void) {
return calloc(1, sizeof(struct avl));
}
int
avl_destroy(
struct avl*... | #include <stdlib.h>
#include "avl.h"
/*
*
*
* forward declarations
*
*
*/
static void
destroy_subtree(
struct avl_el* node //!< A node to destroy
);
/**
* Rotate a node counter-clockwise
*
* @return new root or NULL, if the rotation could not be performed
*/
static struct avl_el*
rotate_left(
str... |
Fix compile error on chrome bots | /*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrSlug_DEFINED
#define GrSlug_DEFINED
#include "include/private/chromium/Slug.h"
// TODO: Update Chrome to use sktext::gpu classes and remove these
using GrTextRefere... | /*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrSlug_DEFINED
#define GrSlug_DEFINED
#include "include/private/chromium/Slug.h"
// TODO: Update Chrome to use sktext::gpu classes and remove these
using GrSlug = skt... |
Exclude Clang on Windows too. Comment this up a bit. | /*
* Copyright 2014 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkBlitRow_opts_SSE4_DEFINED
#define SkBlitRow_opts_SSE4_DEFINED
#include "SkBlitRow.h"
/* Check if we are able to build assembly code, GCC/AT&T s... | /*
* Copyright 2014 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkBlitRow_opts_SSE4_DEFINED
#define SkBlitRow_opts_SSE4_DEFINED
#include "SkBlitRow.h"
/* Check if we are able to build assembly code, GCC/AT&T s... |
Add header function for monitors_create. | #ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
# define E_SMART_RANDR_H
Evas_Object *e_smart_randr_add(Evas *evas);
# endif
#endif
| #ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
# define E_SMART_RANDR_H
Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_monitors_create(Evas_Object *obj);
# endif
#endif
|
Add old file from week2 | #include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main() {
int fd1, fd2;
fd1 = open("f1", O_RDWR);
fd2 = open("f1", O_RDWR);
lseek(fd1, -5, SEEK_END);
lseek(fd2, 4, SEEK_SET);
write(fd1, "xyzw", 4);
write(fd2, "12", 2);
char buff[10];
int count;
lseek(fd1, 0, SEEK_SET);
while (coun... | |
Convert utils to pragma once | #ifndef ELKENUMS_H
#define ELKENUMS_H
/** ElkEnums contains various enumerations useful in ELK, such as real/imag component definitions in
* Kernels, BCs, etc.
*/
namespace elk
{
enum ComponentEnum
{
REAL,
IMAGINARY
};
} // namespace elk
#endif // ELKENUMS_H
| #pragma once
/** ElkEnums contains various enumerations useful in ELK, such as real/imag component definitions in
* Kernels, BCs, etc.
*/
namespace elk
{
enum ComponentEnum
{
REAL,
IMAGINARY
};
} // namespace elk
|
Add test for strtod function | /**
* @file
* @brief
*
* @date 26.02.13
* @author Alexander Lapshin
*/
#include <embox/test.h>
#include <stdlib.h>
EMBOX_TEST_SUITE("standard library");
TEST_CASE("Check strtod function") {
test_assert_equal(0, (int) atof("0.0"));
test_assert_equal(10, (int) (10 * atof("1.0")));
test_assert_equ... | /**
* @file
* @brief
*
* @date 26.02.13
* @author Alexander Lapshin
*/
#include <embox/test.h>
#include <stdlib.h>
EMBOX_TEST_SUITE("standard library");
TEST_CASE("Check strtod function") {
test_assert_equal(0, (int) atof("0.0"));
test_assert_equal(10, (int) (10 * atof("1.0")));
test_assert_equ... |
Fix character frequency map to be sorted in ascending order | #include "pair.h"
pair new_pair( const char c, const int freq ) {
pair p;
p.c = c;
p.freq = freq;
return p;
}
int compare_freq( const void *a, const void *b ) {
const pair *ia = ( const pair * ) a;
const pair *ib = ( const pair * ) b;
return ib->freq - ia->freq;
}
| #include "pair.h"
pair new_pair( const char c, const int freq ) {
pair p;
p.c = c;
p.freq = freq;
return p;
}
int compare_freq( const void *a, const void *b ) {
const pair *ia = ( const pair * ) a;
const pair *ib = ( const pair * ) b;
return ia->freq - ib->freq;
}
|
Fix uninitialed member variable in ParticlesShape | // This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions 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/LICE... | // This file is a part of the OpenSurgSim project.
// Copyright 2013-2016, SimQuest Solutions 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... |
Define convenient FATAL_ERROR() and FATAL_ERROR_IF() macros | /*
* Copyright 2006 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing ... | /*
* Copyright 2006 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing ... |
Add enum values: Timeout, Invalid, NoSupport to eErrorCode | /*
<License>
Copyright 2015 Virtium Technology
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... | /*
<License>
Copyright 2015 Virtium Technology
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... |
Disable clang diagnostics pragma on windows | #ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_
// TODO: Move logging to OrbitBase once we have clearer plans for such module.
#include <cstdio>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#define LOG(format, ...) fprintf(stderr,... | #ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_
// TODO: Move logging to OrbitBase once we have clearer plans for such module.
#include <cstdio>
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#define LOG(form... |
Fix again error: include of non-modular header inside framework module | //
// IRHTTPJSONOperation.h
// IRKit
//
// Created by Masakazu Ohtsuka on 2013/12/02.
//
//
#import "ISHTTPOperation.h"
@interface IRHTTPJSONOperation : ISHTTPOperation
@end
| //
// IRHTTPJSONOperation.h
// IRKit
//
// Created by Masakazu Ohtsuka on 2013/12/02.
//
//
// #import "ISHTTPOperation.h"
@import ISHTTPOperation;
@interface IRHTTPJSONOperation : ISHTTPOperation
@end
|
Add note on supported field value types. | //
// CLuceneSearchService.h
// BRFullTextSearch
//
// Created by Matt on 6/28/13.
// Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//
#import <Foundation/Foundation.h>
#import "BRSearchService.h"
@interface CLuceneSearchService : NSObject <BRSearchService>
//... | //
// CLuceneSearchService.h
// BRFullTextSearch
//
// Implementation of BRSearchService using CLucene. When indexing, only NSString, or
// NSArray/NSSet with NSString values, are supported as field values.
//
// Created by Matt on 6/28/13.
// Copyright (c) 2013 Blue Rocket. Distributable under the terms of the A... |
Fix unsigned/signed comparison in UfopaediaCategory::EventOccurred | #pragma once
#include "framework/stage.h"
#include "framework/includes.h"
#include "ufopaediaentry.h"
namespace OpenApoc
{
class UfopaediaCategory : public Stage // , public std::enable_shared_from_this<UfopaediaCategory>
{
private:
Form *menuform;
StageCmd stageCmd;
void SetCatOffset(int Direction);
public... | #pragma once
#include "framework/stage.h"
#include "framework/includes.h"
#include "ufopaediaentry.h"
namespace OpenApoc
{
class UfopaediaCategory : public Stage // , public std::enable_shared_from_this<UfopaediaCategory>
{
private:
Form *menuform;
StageCmd stageCmd;
void SetCatOffset(int Direction);
public... |
Add missing header to git | #ifndef AL_BACKENDS_BASE_H
#define AL_BACKENDS_BASE_H
#include "alMain.h"
struct ALCbackendVtable;
typedef struct ALCbackend {
const struct ALCbackendVtable *vtbl;
ALCdevice *mDevice;
} ALCbackend;
struct ALCbackendVtable {
void (*const Destruct)(ALCbackend *state);
ALCenum (*const open)(ALCbacke... | |
Add an IPI used for testing proper operation of delivering IPIs. | /*
* $FreeBSD$
*/
#ifndef _MACHINE_SMP_H_
#define _MACHINE_SMP_H_
#ifdef _KERNEL
/*
* Interprocessor interrupts for SMP. The following values are indices
* into the IPI vector table. The SAL gives us the vector used for AP
* wake-up. Keep the IPI_AP_WAKEUP at index 0.
*/
#define IPI_AP_WAKEUP 0
#define IPI_AST... | /*
* $FreeBSD$
*/
#ifndef _MACHINE_SMP_H_
#define _MACHINE_SMP_H_
#ifdef _KERNEL
/*
* Interprocessor interrupts for SMP. The following values are indices
* into the IPI vector table. The SAL gives us the vector used for AP
* wake-up. Keep the IPI_AP_WAKEUP at index 0.
*/
#define IPI_AP_WAKEUP 0
#define IPI_AST... |
Remove debug logging and disable test on ppc64be | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
// Crashes on powerpc64be
// XFAIL: target-is-powerpc64be
#include "test.h"
int var;
void *Thread(void *x) {
pthread_exit(&var);
return 0;
}
int main() {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
void *retval = 0;
pthread_join(t, &ret... | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
// Crashes on powerpc64be
// UNSUPPORTED: powerpc64
#include "test.h"
int var;
void *Thread(void *x) {
pthread_exit(&var);
return 0;
}
int main() {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
void *retval = 0;
pthread_join(t, &retval);
... |
Fix so that no workaround is required. | /* See LICENSE file for copyright and license details. */
#include "internals.h"
void
libzahl_realloc(z_t a, size_t need)
{
#if defined(__clang__) /* https://llvm.org/bugs/show_bug.cgi?id=26930 */
volatile size_t j;
#else
# define j i
#endif
size_t i, x;
zahl_char_t *new;
/* Find n such that n is a minimal powe... | /* See LICENSE file for copyright and license details. */
#include "internals.h"
void
libzahl_realloc(z_t a, size_t need)
{
size_t i, x;
zahl_char_t *new;
/* Find n such that n is a minimal power of 2 ≥ need. */
if (likely((need & (~need + 1)) != need)) {
need |= need >> 1;
need |= need >> 2;
need |= need ... |
Fix per Noris Datum's E-Mail. | #ifndef CONFIG_EXPORTER_H
#define CONFIG_EXPORTER_H
class ConfigClass;
class ConfigObject;
class ConfigValue;
class ConfigExporter {
protected:
ConfigExporter(void)
{ }
~ConfigExporter()
{ }
public:
virtual void field(const ConfigValue *, const std::string&) = 0;
virtual void object(const ConfigClass *, cons... | #ifndef CONFIG_EXPORTER_H
#define CONFIG_EXPORTER_H
class ConfigClass;
class ConfigObject;
class ConfigValue;
class ConfigExporter {
protected:
ConfigExporter(void)
{ }
virtual ~ConfigExporter()
{ }
public:
virtual void field(const ConfigValue *, const std::string&) = 0;
virtual void object(const ConfigClass... |
Fix import to fix Flutter build | // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_PLATFORM_FLOATING_POINT_H_
#define RUNTIME_PLATFORM_FLOATING_POINT_H_
#include <cmath>... | // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_PLATFORM_FLOATING_POINT_H_
#define RUNTIME_PLATFORM_FLOATING_POINT_H_
#include <math.h... |
Set default nullptr value on animation sheet texture | /*
Copyright 2015 Ahnaf Siddiqui
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 i... | /*
Copyright 2015 Ahnaf Siddiqui
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 i... |
Define clock frequency before includes | /*
* @file main.c
* @brief Set PORTC I/O pins using data direction register,
* read input from pins and set high PORTC.0 2 and 3
* if input pin PORTC.6 is high.
* @date 06 Jun 2016 10:28 PM
*/
#include <avr/io.h>
#include <util/delay.h>
#define __DELAY_BACKWARD_COMPATIBLE__
#ifndef ... | /*
* @file main.c
* @brief Set PORTC I/O pins using data direction register,
* read input from pins and set high PORTC.0 2 and 3
* if input pin PORTC.6 is high.
* @date 06 Jun 2016 10:28 PM
*/
#define __DELAY_BACKWARD_COMPATIBLE__
#ifndef F_CPU
#define F_CPU 16000000UL /* 16 MHz cl... |
Fix compile error for ML300/403 | /*
* arch/ppc/platforms/4xx/virtex.h
*
* Include file that defines the Xilinx Virtex-II Pro processor
*
* Author: MontaVista Software, Inc.
* source@mvista.com
*
* 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
* terms of the GNU General Public License version 2. This program... | /*
* arch/ppc/platforms/4xx/virtex.h
*
* Include file that defines the Xilinx Virtex-II Pro processor
*
* Author: MontaVista Software, Inc.
* source@mvista.com
*
* 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
* terms of the GNU General Public License version 2. This program... |
Add header for ANX7491 retimer | /* 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.
*
* ANX7491:10G USB 3.2 Re-timer (1-Port)
*/
#ifndef __CROS_EC_USB_RETIMER_ANX7491_H
#define __CROS_EC_USB_RETIMER_ANX7491_H
/* I2C interface addre... | |
Change import priority of RCTBridgeModule |
#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>
#endif
#import <UIKit/UIKit.h>
#include <libkern/OSAtomic.h>
#include <execinfo.h>
@interface ReactNativeExceptionHandler : NSObject <RCTBridgeModule>
+ (void) replaceNativeExceptionHandlerBlock:(void (^)(NSEx... |
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#else
#import "RCTBridgeModule.h"
#endif
#import <UIKit/UIKit.h>
#include <libkern/OSAtomic.h>
#include <execinfo.h>
@interface ReactNativeExceptionHandler : NSObject <RCTBridgeModule>
+ (void) replaceNativeExceptionHandlerBlock:(void (^... |
Include new header in old header for backwards compatibility. | // The libMesh Finite Element Library.
// Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// 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 ... | // The libMesh Finite Element Library.
// Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// 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 ... |
Implement the new optional getRegisterInfo | //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===//
//
// This file declares the X86 specific subclass of TargetMachine.
//
//===----------------------------------------------------------------------===//
#ifndef X86TARGETMACHINE_H
#define X86TARGETMACHINE_H
#include "llvm/Target/TargetM... | //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===//
//
// This file declares the X86 specific subclass of TargetMachine.
//
//===----------------------------------------------------------------------===//
#ifndef X86TARGETMACHINE_H
#define X86TARGETMACHINE_H
#include "llvm/Target/TargetM... |
Add a bit more threshold | #ifndef BORDERS_H
#define BORDERS_H
#include <cstdlib>
#include <cmath>
/** A line will be considered as having content if 0.25% of it is filled. */
const float filledRatioLimit = 0.0025;
/** When the threshold is closer to 1, less content will be cropped. **/
#define THRESHOLD 0.65
const uint16_t redThreshold_RGB_... | #ifndef BORDERS_H
#define BORDERS_H
#include <cstdlib>
#include <cmath>
/** A line will be considered as having content if 0.25% of it is filled. */
const float filledRatioLimit = 0.0025;
/** When the threshold is closer to 1, less content will be cropped. **/
#define THRESHOLD 0.75
const uint16_t redThreshold_RGB_... |
Add test of namespaces and structs/unions | /*
name: TEST015
description: Stress namespace mechanism
output:
test015.c:21: warning: 's1' defined but not used
S7 s2
(
M8 I s
)
S4 s1
(
M5 I s
M9 S7 s2
)
S2 s
(
M10 S4 s1
)
G11 S2 s
F1
G12 F1 main
{
-
j L2
A3 S2 s2
L4
yI G11 M10 .S4 M5 .I G11 M10 .S4 M9 .S7 M8 .I +I
L2
yI A3 M10 .S4 M9 .S7 M8 .I
}
*/
#line 1
st... | |
Add const to hw_button_enabled() definition. | #ifndef CONTROL_LOOP_INL_H
#define CONTROL_LOOP_INL_H
#include "board.h"
#include "bitband.h"
namespace hardware {
inline
bool ControlLoop::hw_button_enabled()
{
return MEM_ADDR(BITBAND(reinterpret_cast<uint32_t>(&(GPIOF->IDR)),
GPIOF_HW_SWITCH_PIN));
}
}
#endif
| #ifndef CONTROL_LOOP_INL_H
#define CONTROL_LOOP_INL_H
#include "board.h"
#include "bitband.h"
namespace hardware {
inline
bool ControlLoop::hw_button_enabled() const
{
return MEM_ADDR(BITBAND(reinterpret_cast<uint32_t>(&(GPIOF->IDR)),
GPIOF_HW_SWITCH_PIN));
}
}
#endif
|
Add missing cstddef header for size_t | #ifndef FORMAT_H
#define FORMAT_H
#include <cstring> // memmove
class Format
{
public:
Format(void *p, size_t s = 0) : fp((char *)p), size(s) {};
size_t Leanify(size_t size_leanified = 0)
{
if (size_leanified)
{
memmove(fp - size_leanified, fp, size);
fp -= siz... | #ifndef FORMAT_H
#define FORMAT_H
#include <cstddef>
#include <cstring> // memmove
class Format
{
public:
Format(void *p, size_t s = 0) : fp((char *)p), size(s) {};
size_t Leanify(size_t size_leanified = 0)
{
if (size_leanified)
{
memmove(fp - size_leanified, fp, size);
... |
Remove some debug output from decode initialization. | #include "vpx_ports/config.h"
#include "opencl/vp8_opencl.h"
#include "opencl/vp8_decode_cl.h"
#include <stdio.h>
extern int cl_init_dequant();
extern int cl_destroy_dequant();
int cl_decode_destroy(){
int err;
err = cl_destroy_dequant();
return CL_SUCCESS;
}
int cl_decode_init()
{
int err;
... | #include "vpx_ports/config.h"
#include "../../common/opencl/vp8_opencl.h"
#include "vp8_decode_cl.h"
#include <stdio.h>
extern int cl_init_dequant();
extern int cl_destroy_dequant();
int cl_decode_destroy(){
int err;
err = cl_destroy_dequant();
return CL_SUCCESS;
}
int cl_decode_init()
{
int ... |
Drop another unused libunw cursor member. | //
// This software was produced with support in part from the Defense Advanced
// Research Projects Agency (DARPA) through AFRL Contract FA8650-09-C-1915.
// Nothing in this work should be construed as reflecting the official policy or
// position of the Defense Department, the United States government, or
// Rice Un... | //
// This software was produced with support in part from the Defense Advanced
// Research Projects Agency (DARPA) through AFRL Contract FA8650-09-C-1915.
// Nothing in this work should be construed as reflecting the official policy or
// position of the Defense Department, the United States government, or
// Rice Un... |
Add octApron test where threadenter doesn't remove locals | // SKIP PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>
void *t_fun(void *arg) {
int x; // threadenter shouldn't pass value for x here
assert(x == 3); // UNKNOWN!
return NULL;
}
int main(void) {
int x = 3;
pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);
return 0;... | |
Bring in POSIX message queue header file. | /*-
* Copyright (c) 2005 David Xu <davidxu@freebsd.org>
* 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, t... | |
Add trampoline code to call function withn respect to the incoming JSON method. | #include <stdint.h>
#include <stdio.h>
#include "compiler.h"
#include "cJSON.h"
#include "parse.h"
int parse_message(const char *msg, uint32_t length)
{
cJSON *root;
const char *end_parse;
root = cJSON_ParseWithOpts(msg, &end_parse, 0);
if (unlikely(root == NULL)) {
fprintf(stderr, "Could not parse JSON!\n");
... | #include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "compiler.h"
#include "cJSON.h"
#include "parse.h"
int parse_message(const char *msg, uint32_t length)
{
cJSON *root;
const char *end_parse;
root = cJSON_ParseWithOpts(msg, &end_parse, 0);
if (unlikely(root == NULL)) {
fprintf(stderr, "Could n... |
Fix webp compile warnings on windows | /*
* Copyright 2015 Google, Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// FIXME: Workaround for skbug.com/4037
// Some of our test machines have an older version of clang that does not
// have
// __builtin_bswap16
//
// But libwebp expects th... | /*
* Copyright 2015 Google, Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// FIXME: Workaround for skbug.com/4037
// Some of our test machines have an older version of clang that does not
// have
// __builtin_bswap16
//
// But libwebp expects th... |
Remove logger ids loop from sample | #ifndef MYTHREAD_H
#define MYTHREAD_H
#include <QThread>
#include "easylogging++.h"
class MyThread : public QThread {
Q_OBJECT
public:
MyThread(int id) : threadId(id) {}
private:
int threadId;
protected:
void run() {
LINFO <<"Writing from a thread " << threadId;
LVERBOSE(2) << "This ... | #ifndef MYTHREAD_H
#define MYTHREAD_H
#include <QThread>
#include "easylogging++.h"
class MyThread : public QThread {
Q_OBJECT
public:
MyThread(int id) : threadId(id) {}
private:
int threadId;
protected:
void run() {
LINFO <<"Writing from a thread " << threadId;
LVERBOSE(2) << "This ... |
Set up actual compiler detections. Only supports gcc and msvc at the moment | #ifndef OI_OS
#define OI_OS 1
#if defined(_WIN32) || defined(__WIN32__)
# define OI_WIN
# ifdef _MSC_VER
# define OI_MSVC
# else
# define OI_GCC
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
#elif defined(linux) || defined(__linux)
# define OI... | #ifndef OI_OS
#define OI_OS 1
#if defined(__GNUC__)
# define OI_GCC
#elif defined(_MSC_VER)
# define OI_MSVC
#else
# warning oi does not recognize compiler
# define OI_UNKNOWN_CC
#endif
#if defined(_WIN32) || defined(__WIN32__)
# define OI_WIN
#
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
... |
Call _exit instead of exit on assertion failure. | #include <errno.h>
#include <unistd.h>
#include "iobuf.h"
static const char errmsg[] = "ibuf_refill called with non-empty buffer!\n";
int ibuf_refill(ibuf* in)
{
iobuf* io;
unsigned oldlen;
unsigned rd;
io = &(in->io);
if (io->flags) return 0;
if (io->bufstart != 0) {
if (io->bufstart < io->buflen) {... | #include <errno.h>
#include <unistd.h>
#include "iobuf.h"
static const char errmsg[] = "ibuf_refill called with non-empty buffer!\n";
int ibuf_refill(ibuf* in)
{
iobuf* io;
unsigned oldlen;
unsigned rd;
io = &(in->io);
if (io->flags) return 0;
if (io->bufstart != 0) {
if (io->bufstart < io->buflen) {... |
Add Perry Metzger's wrapper to run the svnserve process setgid, since this can be very helpful to svn+ssh users. Quoting from the comments: | /*
* Wrapper to run the svnserve process setgid.
* The idea is to avoid the problem that some interpreters like bash
* invoked by svnserve in hook scripts will reset the effective gid to
* the real gid, nuking the effect of an ordinary setgid svnserve binary.
* Sadly, to set the real gid portably, you need to be r... | |
Correct macro spelling to fix Linux build | // For conditions of distribution and use, see copyright notice in LICENSE
#pragma once
#if defined (_WINDOWS)
#if defined(WEBSOCKET_MODULE_EXPORTS)
#define WEBSOCKET_SERVER_MODULE_API __declspec(dllexport)
#else
#define WEBSOCKET_SERVER_MODULE_API __declspec(dllimport)
#endif
#else
#define WEBSOCKET_MODULE_API
#endi... | // For conditions of distribution and use, see copyright notice in LICENSE
#pragma once
#if defined (_WINDOWS)
#if defined(WEBSOCKET_MODULE_EXPORTS)
#define WEBSOCKET_SERVER_MODULE_API __declspec(dllexport)
#else
#define WEBSOCKET_SERVER_MODULE_API __declspec(dllimport)
#endif
#else
#define WEBSOCKET_SERVER_MODULE_AP... |
Fix compilation error, cast was missing | #include <mbstr.h>
#include <stdlib.h>
#include "../intern.h"
#ifdef __cplusplus
extern "C" {
#endif
char* __mbschr (char* str, mbchar_t c)
{
if (c < 0x80) {
return __strchr(str, c);
}
else {
char buf[sizeof(mbchar_t)+1];
*((mbchar_t*)buf) = c;
buf[__min(sizeof(mbchar_t),MB... | #include <mbstr.h>
#include <stdlib.h>
#include "../intern.h"
#ifdef __cplusplus
extern "C" {
#endif
char* __mbschr (char* str, mbchar_t c)
{
if (c < 0x80) {
return __strchr(str, c);
}
else {
char buf[sizeof(mbchar_t)+1];
*((mbchar_t*)buf) = c;
buf[__min(sizeof(mbchar_t),(s... |
Use ISR for serial loopback instead of a blocking read | // Takes in a character at a time and sends it right back out,
// displaying the ASCII value on the LEDs.
// Uses interrupt system instead of a blocking read.
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "USART.h"
// Single character for serial TX/RX and "byte received" flag
volatil... | |
Increment version number to 1.32 | #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.31f;
| #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.32f;
|
Add unsound negative int to unsigned int branch invariant test | // PARAM: --enable ana.int.def_exc --enable ana.int.interval
// ldv-benchmarks: u__linux-concurrency_safety__drivers---net---ethernet---amd---pcnet32.ko.c
#include <assert.h>
int main() {
int debug_value = -1;
if ((unsigned int)debug_value > 31U)
assert(1); // reachable
else
assert(1); // NOWARN (unreac... | |
Add missing CONTENT_EXPORT to fix Linux shared build after r112415 | // 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_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_WINDOW_H_
#define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_WINDOW_H_
#pragma once
class TabContents;... | // 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_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_WINDOW_H_
#define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_WINDOW_H_
#pragma once
class TabContents;... |
Revert "bluetooth: Our kernel is missing CLOCK_BOOTTIME_ALARM (alarmtimer)" | /*
* Copyright 2013 The Android Open Source Project
*
* 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 applica... | /*
* Copyright 2013 The Android Open Source Project
*
* 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 applica... |
Fix typo in include file | // Copyright 2016 Pierre Fourgeaud
#ifndef PF_CONSOLELOGGER_H_
#define PF_CONSOLELOGGER_H_
#include <iostream>
#include <string>
#include "./iloglistener.h"
#include "./Logger.h"
/**
* @brief The FileLogger class
*
* Logger that will write the ouput to the console (cerr or cout depending on log level)
*/
class C... | // Copyright 2016 Pierre Fourgeaud
#ifndef PF_CONSOLELOGGER_H_
#define PF_CONSOLELOGGER_H_
#include <iostream>
#include <string>
#include "./iloglistener.h"
#include "./logger.h"
/**
* @brief The FileLogger class
*
* Logger that will write the ouput to the console (cerr or cout depending on log level)
*/
class C... |
Add a testcase for WockyXmppConnection and check its istantiation | #include <stdio.h>
#include <unistd.h>
#include <glib.h>
#include <wocky/wocky-xmpp-connection.h>
#include <wocky/wocky-transport.h>
#include "test-transport.h"
#include <check.h>
START_TEST (test_instantiation)
{
WockyXmppConnection *connection;
TestTransport *transport;
g_type_init();
transport = test_tr... | |
Add PipePairSimple which allows a user to simply construct a single object which implements a PipePair. | #ifndef IO_PIPE_PAIR_SIMPLE_H
#define IO_PIPE_PAIR_SIMPLE_H
#include <io/pipe_simple.h>
#include <io/pipe_simple_wrapper.h>
class PipePairSimple : public PipePair {
PipeSimpleWrapper<PipePairSimple> *incoming_pipe_;
PipeSimpleWrapper<PipePairSimple> *outgoing_pipe_;
protected:
PipePairSimple(void)
: incoming_pipe... | |
Remove item from umbrella header. | ////////////////////////////////////////////////////////////////////////////////
//
// JASPER BLUES
// Copyright 2012 Jasper Blues
// All Rights Reserved.
//
// NOTICE: Jasper Blues permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
///... | ////////////////////////////////////////////////////////////////////////////////
//
// JASPER BLUES
// Copyright 2012 Jasper Blues
// All Rights Reserved.
//
// NOTICE: Jasper Blues permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
///... |
Include required header in source |
#ifndef MACRO_H_
#define MACRO_H_
#include <stdio.h>
#define HEX_PRINT(X,Y) { int zz; for(zz = 0; zz < Y; zz++) fprintf(stderr, "%02X", X[zz]); fprintf(stderr, "\n"); }
#define MKINT_BE16(X) ( (X)[0] << 8 | (X)[1] )
#define MKINT_BE24(X) ( (X)[0] << 16 | (X)[1] << 8 | (X)[2] )
#define MKINT_BE32(X) ( (X)[0] << 24 | ... | |
Add nullability info to root ModelObject | //
// ETA_ModelObject.h
// ETA-SDK
//
// Created by Laurie Hufford on 7/11/13.
// Copyright (c) 2013 eTilbudsavis. All rights reserved.
//
#import "Mantle.h"
#import "NSValueTransformer+ETAPredefinedValueTransformers.h"
@interface ETA_ModelObject : MTLModel <MTLJSONSerializing>
// setting either uuid or ern wil... | //
// ETA_ModelObject.h
// ETA-SDK
//
// Created by Laurie Hufford on 7/11/13.
// Copyright (c) 2013 eTilbudsavis. All rights reserved.
//
#import "Mantle.h"
#import "NSValueTransformer+ETAPredefinedValueTransformers.h"
@interface ETA_ModelObject : MTLModel <MTLJSONSerializing>
// setting either uuid or ern wil... |
Add new header file. (or: xcode is stupid) | //
// BDSKOAIGroupServer.h
// Bibdesk
//
// Created by Christiaan Hofman on 1/1/07.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "BDSKSearchGroup.h"
@class BDSKServerInfo;
@interface BDSKOAIGroupServer : NSObject <BDSKSearchGroupServer>
{
BDSKSearchGroup *group... | |
Update driver version to 8.07.00.18-k | /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2014 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.07.00.16-k"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 7
#define QLA_DRIVER_PATCH_VER 0
#defi... | /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2014 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.07.00.18-k"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 7
#define QLA_DRIVER_PATCH_VER 0
#defi... |
Rename delegate from MKMapViewDelegate to REMarkerClusterDelegate | //
// DemoViewController.h
// REMarkerClustererExample
//
// Created by Roman Efimov on 7/9/12.
// Copyright (c) 2012 Roman Efimov. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "REMarkerClusterer.h"
@interface DemoViewController : UIViewController <MKMapViewDelegate>
@property (strong, readonly, nonat... | //
// DemoViewController.h
// REMarkerClustererExample
//
// Created by Roman Efimov on 7/9/12.
// Copyright (c) 2012 Roman Efimov. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "REMarkerClusterer.h"
@interface DemoViewController : UIViewController <REMarkerClusterDelegate>
@property (strong, readonly,... |
Update iOS SDK Minor Version | // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
#ifndef WindowsAzureMobileServices_WindowsAzureMobileServices_h
#define WindowsAzureMobileServices... | // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
#ifndef WindowsAzureMobileServices_WindowsAzureMobileServices_h
#define WindowsAzureMobileServices... |
Check for return value for asprintf | #include <stdio.h>
#include <stdlib.h> /* for free */
#include <string.h> /* for strcmp */
#include <strings.h>
#include <platform/cbassert.h>
static void test_asprintf(void) {
char *result = 0;
(void)asprintf(&result, "test 1");
cb_assert(strcmp(result, "test 1") == 0);
free(result);
(void)aspri... | #include <stdio.h>
#include <stdlib.h> /* for free */
#include <string.h> /* for strcmp */
#include <strings.h>
#include <platform/cbassert.h>
static void test_asprintf(void) {
char *result = 0;
cb_assert(asprintf(&result, "test 1") > 0);
cb_assert(strcmp(result, "test 1") == 0);
free(result);
cb... |
Mark Devcoin release version 0.8.9.0. | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning and copyright year
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 8
#define CLIENT_VERSION_BUILD ... | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning and copyright year
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 9
#define CLIENT_VERSION_BUILD ... |
Remove duplicate definition of MessageAuthenticationCode::name() | /*
* Base class for message authentiction codes
* (C) 1999-2007 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_MESSAGE_AUTH_CODE_BASE_H__
#define BOTAN_MESSAGE_AUTH_CODE_BASE_H__
#include <botan/buf_comp.h>
#include <botan/sym_algo.h>
#include <botan/scan_name.h>
... | /*
* Base class for message authentiction codes
* (C) 1999-2007 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_MESSAGE_AUTH_CODE_BASE_H__
#define BOTAN_MESSAGE_AUTH_CODE_BASE_H__
#include <botan/buf_comp.h>
#include <botan/sym_algo.h>
#include <botan/scan_name.h>
... |
Use C calling convention when header is included by C++ code | #ifndef _SHAKE_H_
#define _SHAKE_H_
#include "shake_private.h"
struct shakeDev;
/* libShake functions */
int shakeInit();
void shakeQuit();
void shakeListDevices();
int shakeNumOfDevices();
shakeDev *shakeOpen(unsigned int id);
void shakeClose(shakeDev *dev);
int shakeQuery(shakeDev *dev);
void shakeSetGain(shakeDev... | #ifndef _SHAKE_H_
#define _SHAKE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "shake_private.h"
struct shakeDev;
/* libShake functions */
int shakeInit();
void shakeQuit();
void shakeListDevices();
int shakeNumOfDevices();
shakeDev *shakeOpen(unsigned int id);
void shakeClose(shakeDev *dev);
int shakeQuery(sh... |
Add replacement functionality following initialization segment | #! /usr/bin/tcc -run
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct slot
{
ssize_t size;
char *row;
} slot;
slot line;
slot *text;
char *ptr;
int main(void) {
ptr = "this is my story";
line.row = ptr;
line.size = strlen(ptr);
text = malloc(10*siz... | #! /usr/bin/tcc -run
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct slot
{
ssize_t size;
char *row;
} slot;
slot line;
slot *text;
slot *old;
slot *new;
char *ptr;
int main(void) {
text = malloc(10*sizeof(slot));
old = malloc(10*sizeof(slot));
... |
Add documentation to Point3 typedefs | /******************************************************************************
**
** 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 ... |
Fix tls value passed during clone | /* Copyright (C) 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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 Licen... | /* Copyright (C) 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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 Licen... |
Fix error result handling in os.rmdir() | /**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z... | /**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z... |
Change session length to 60s | /*
* Copyright 2016 Adam Chyła, adam@chyla.org
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H
#define SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H
namespace apache
{
namespace analyzer
{
namespace detail
{
constexpr int SESSION_LENGTH... | /*
* Copyright 2016 Adam Chyła, adam@chyla.org
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H
#define SRC_APACHE_ANALYZER_DETAIL_SESSION_LENGTH_H
namespace apache
{
namespace analyzer
{
namespace detail
{
constexpr int SESSION_LENGTH... |
Remove getZip() which got there by mistake | #ifndef QUAZIP_TEST_QUAZIP_H
#define QUAZIP_TEST_QUAZIP_H
#include <QObject>
class TestQuaZip: public QObject {
Q_OBJECT
private slots:
void getFileList_data();
void getFileList();
void getZip();
};
#endif // QUAZIP_TEST_QUAZIP_H
| #ifndef QUAZIP_TEST_QUAZIP_H
#define QUAZIP_TEST_QUAZIP_H
#include <QObject>
class TestQuaZip: public QObject {
Q_OBJECT
private slots:
void getFileList_data();
void getFileList();
};
#endif // QUAZIP_TEST_QUAZIP_H
|
Delete main widget in BasicUi |
#ifndef BASICUI_H_
#define BASICUI_H_
#include <QMainWindow>
class MainWidget;
class Workspace;
class BasicUi: public QMainWindow {
Q_OBJECT
public:
BasicUi(QWidget *parent = 0);
void setWorkspace(Workspace *);
private:
MainWidget *mainWidget;
// QGridLayout *layout;
... |
#ifndef BASICUI_H_
#define BASICUI_H_
#include <QMainWindow>
class MainWidget;
class Workspace;
class BasicUi: public QMainWindow {
Q_OBJECT
public:
BasicUi(QWidget *parent = 0);
void setWorkspace(Workspace *);
~BasicUi(){
if(NULL != mainWidget)
delete m... |
Add simple test case to make sure driver can generate executables. - Hopefully Chris can pardon one executable test. | // RUN: clang-driver -ccc-echo -o %t %s &> %t.log &&
// Make sure we used clang.
// RUN: grep 'clang" .*hello.c' %t.log &&
// RUN: %t > %t.out &&
// RUN: grep "I'm a little driver, short and stout." %t.out
#include <stdio.h>
int main() {
printf("I'm a little driver, short and stout.");
return 0;
}
| |
Add missing new files for revision 32092 | #include <complex>
#ifndef __hpux
using namespace std;
#endif
#pragma create TClass std::complex<int>+;
#pragma create TClass std::complex<long>+;
#pragma create TClass std::complex<float>+;
#pragma create TClass std::complex<double>+;
#ifdef G__NATIVELONGLONG
#pragma create TClass std::complex<long long>+;
// #pragm... | |
Initialize argv vectors using compound literals. | #include "pipe.h"
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
/* Command argument vectors. */
char *more_argv[] = { "more", NULL };
char *less_argv[] = { "less", NULL };
char *pager_argv[] = { getenv("PAGER"), NULL };
char *sort_argv[] = { "sort", NUL... | #include "pipe.h"
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
char *pager_env = getenv("PAGER");
/* Construct pipeline. */
/* file argv err next fallback */
command_t more = {"more", (char *[]){"more", NU... |
Prepare for more SEE tests | /* Make sure assert is not disabled */
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <stdio.h>
#include <assert.h>
#include "see.h"
#include "fen.h"
void test_see()
{
chess_state_t s;
int result;
int pos_from = D3;
int pos_to = E5;
int type = KNIGHT;
int capture_type = PAWN;
int special = MO... | /* Make sure assert is not disabled */
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <stdio.h>
#include <assert.h>
#include "see.h"
#include "fen.h"
void test_see(const char *fen, short expected_result)
{
chess_state_t s;
int result;
int pos_from = D3;
int pos_to = E5;
int type = KNIGHT;
int cap... |
Resolve 'control reaches end of non-void function' | #include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include "tock.h"
#pragma GCC diagnostic ignored "-Wunused-parameter"
void yield_for(bool *cond) {
while(!*cond) {
yield();
}
}
void yield() {
asm volatile("push {lr}\nsvc 0\npop {pc}" ::: "memory", "r0");
}
int subscribe(u... | #include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include "tock.h"
#pragma GCC diagnostic ignored "-Wunused-parameter"
void yield_for(bool *cond) {
while(!*cond) {
yield();
}
}
void yield() {
asm volatile("push {lr}\nsvc 0\npop {pc}" ::: "memory", "r0");
}
int subscribe(u... |
Add first stub for HSM unit test | #include "mbb/test.h"
#include "mbb/hsm.h"
#include "mbb/debug.h"
MHSM_DEFINE_STATE(state_a, NULL);
MHSM_DEFINE_STATE(state_a1, &state_a);
MHSM_DEFINE_STATE(state_a11, &state_a1);
mhsm_state_t *state_a_fun(mhsm_hsm_t *hsm, mhsm_event_t event)
{
switch (event.id) {
case MHSM_EVENT_INITIAL:
return &state_a1;
}
... | |
Fix inclusion order, per Andreas. | /*-------------------------------------------------------------------------
*
* pqsignal.c
* reliable BSD-style signal(2) routine stolen from RWW who stole it
* from Stevens...
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University o... | /*-------------------------------------------------------------------------
*
* pqsignal.c
* reliable BSD-style signal(2) routine stolen from RWW who stole it
* from Stevens...
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University o... |
Use the XirSys defaults for room and application. | //
// PHCredentials.h
// PerchRTC
//
// Created by Sam Symons on 2015-05-08.
// Copyright (c) 2015 Perch Communications. All rights reserved.
//
#ifndef PerchRTC_PHCredentials_h
#define PerchRTC_PHCredentials_h
#error Please enter your XirSys credentials (http://xirsys.com/pricing/)
static NSString *kPHConnectio... | //
// PHCredentials.h
// PerchRTC
//
// Created by Sam Symons on 2015-05-08.
// Copyright (c) 2015 Perch Communications. All rights reserved.
//
#ifndef PerchRTC_PHCredentials_h
#define PerchRTC_PHCredentials_h
#error Please enter your XirSys credentials (http://xirsys.com/pricing/)
static NSString *kPHConnectio... |
Make test more robust by writing stdout/stderr to different files. | // RUN: c-index-test -test-load-source local %s -ivfsoverlay %t/does-not-exist.yaml &> %t.out
// RUN: FileCheck -check-prefix=STDERR %s < %t.out
// STDERR: fatal error: virtual filesystem overlay file '{{.*}}' not found
// RUN: FileCheck %s < %t.out
// CHECK: missing_vfs.c:[[@LINE+1]]:6: FunctionDecl=foo:[[@LINE+1]]:6
... | // RUN: c-index-test -test-load-source local %s -ivfsoverlay %t/does-not-exist.yaml > %t.stdout 2> %t.stderr
// RUN: FileCheck -check-prefix=STDERR %s < %t.stderr
// STDERR: fatal error: virtual filesystem overlay file '{{.*}}' not found
// RUN: FileCheck %s < %t.stdout
// CHECK: missing_vfs.c:[[@LINE+1]]:6: FunctionDe... |
Call the c functions instead of passing a pointer | #include <Python.h>
#include <sys/personality.h>
int Cget_personality(void) {
unsigned long int persona = 0xffffffff;
return personality(persona);
}
static PyObject* get_personality(PyObject* self) {
return Py_BuildValue("i", Cget_personality);
}
int Cset_personality(void) {
unsigned long int persona = READ_IMPL... | #include <Python.h>
#include <sys/personality.h>
#include <stdint.h>
int Cget_personality(void) {
unsigned long persona = 0xffffffffUL;
return personality(persona);
}
static PyObject* get_personality(PyObject* self) {
return Py_BuildValue("i", Cget_personality());
}
int Cset_personality(unsigned long persona) {
... |
Make header file compatible with C++ | #ifndef PG_QUERY_H
#define PG_QUERY_H
typedef struct {
char* message; // exception message
char* filename; // source of exception (e.g. parse.l)
int lineno; // source of exception (e.g. 104)
int cursorpos; // char in query at which exception occurred
} PgQueryError;
typedef struct {
char* parse_tree;
char* st... | #ifndef PG_QUERY_H
#define PG_QUERY_H
typedef struct {
char* message; // exception message
char* filename; // source of exception (e.g. parse.l)
int lineno; // source of exception (e.g. 104)
int cursorpos; // char in query at which exception occurred
} PgQueryError;
typedef struct {
char* parse_tree;
char* st... |
Remove superfluous default db definition |
#ifndef TEST_HELPER_C
#define TEST_HELPER_C (1)
#include "MMDB.h"
#define MMDB_DEFAULT_DATABASE "/usr/local/share/GeoIP/GeoIP2-City.mmdb"
typedef union {
struct in_addr v4;
struct in6_addr v6;
} in_addrX;
char *get_test_db_fname(void);
void ip_to_num(MMDB_s * mmdb, char *ipstr, in_addrX * dest_ipnum);
int ... |
#ifndef TEST_HELPER_C
#define TEST_HELPER_C (1)
#include "MMDB.h"
typedef union {
struct in_addr v4;
struct in6_addr v6;
} in_addrX;
char *get_test_db_fname(void);
void ip_to_num(MMDB_s * mmdb, char *ipstr, in_addrX * dest_ipnum);
int dbl_cmp(double a, double b);
#endif
|
Check for under/overflow in Timeout constructor. Codestyle fixes. | #ifndef CPR_TIMEOUT_H
#define CPR_TIMEOUT_H
#include <cstdint>
#include <chrono>
namespace cpr {
class Timeout {
public:
Timeout(const std::chrono::milliseconds& timeout) : ms(timeout) {}
Timeout(const std::int32_t& timeout) : ms(timeout) {}
std::chrono::milliseconds ms;
};
} // namespace cpr
#endif... | #ifndef CPR_TIMEOUT_H
#define CPR_TIMEOUT_H
#include <cstdint>
#include <chrono>
#include <limits>
#include <stdexcept>
namespace cpr {
class Timeout {
public:
Timeout(const std::chrono::milliseconds& duration) : ms{duration} {
if(ms.count() > std::numeric_limits<long>::max()) {
throw std::... |
Fix printf format, remove unused variables | /*
* Copyright (c) 2016, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once... | /*
* Copyright (c) 2016, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once... |
Disable test; what it's testing for is wrong. | // RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt
#include <math.h>
float foo(float X) {
// Check that this compiles to llvm.sqrt when errno is ignored.
return sqrtf(X);
}
| // RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt
// llvm.sqrt has undefined behavior on negative inputs, so it is
// inappropriate to translate C/C++ sqrt to this.
// XFAIL: *
#include <math.h>
float foo(float X) {
// Check that this compiles to llvm.sqrt when errno is ignored.
return sqrtf(X);
}
|
Add compile time assert macro | /**
* Thanks to http://stackoverflow.com/users/68204/rberteig
* http://stackoverflow.com/questions/807244/c-compiler-asserts-how-to-implement
*/
/** A compile time assertion check.
*
* Validate at compile time that the predicate is true without
* generating code. This can be used at any point in a source file
... | |
Add flag for emacs so it realizes it's C++ code | //***************************************************************************
// class Unique:
// Mixin class for classes that should never be copied.
//
// Purpose:
// This mixin disables both the copy constructor and the
// assignment operator. It also provides a default equality operator.
//
// History:
// 09... | //************************************************************-*- C++ -*-
// class Unique:
// Mixin class for classes that should never be copied.
//
// Purpose:
// This mixin disables both the copy constructor and the
// assignment operator. It also provides a default equality operator.
//
// History:
// 09/24/... |
Fix GCC bug based code (allows to compile with clang) | /* Chrome Linux plugin
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/
#ifndef LABELS... | /* Chrome Linux plugin
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/
#ifndef LABELS... |
Test for rev 73205 (PR 4349) | // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {\\\[2 x \\\[2 x i8\\\]\\\]}
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {\\\[2 x i16\\\]}
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep... | |
Remove abs_to_virt() now all users have been fixed | #ifndef _ASM_POWERPC_ABS_ADDR_H
#define _ASM_POWERPC_ABS_ADDR_H
#ifdef __KERNEL__
/*
* c 2001 PPC 64 Team, IBM Corp
*
* 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 o... | #ifndef _ASM_POWERPC_ABS_ADDR_H
#define _ASM_POWERPC_ABS_ADDR_H
#ifdef __KERNEL__
/*
* c 2001 PPC 64 Team, IBM Corp
*
* 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 o... |
Include std headers instead of C ones | //
// Created by bentoo on 29.11.16.
//
#ifndef GAME_ASSERT_H
#define GAME_ASSERT_H
#include <assert.h>
#include <cstdio>
#include <cstdlib>
#include <utility>
#include "DebugSourceInfo.h"
#ifdef _MSC_VER
#define YAGE_BREAK __debugbreak()
#elif __MINGW32__
#define YAGE_BREAK __builtin_trap()
#else
#include <signal.... | //
// Created by bentoo on 29.11.16.
//
#ifndef GAME_ASSERT_H
#define GAME_ASSERT_H
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <utility>
#include "DebugSourceInfo.h"
#ifdef _MSC_VER
#define YAGE_BREAK __debugbreak()
#elif __MINGW32__
#define YAGE_BREAK __builtin_trap()
#else
#include <csignal>... |
Add list of functions for SDP power supply | #ifndef __SDP2XXX_H___
#define __SDP2XXX_H___
"SESS__\r"
"ENDS__\r"
"CCOM__??\r"
"GCOM__\r"
"GMAX__\r"
"GOVP__\r"
"GETD__\r"
"GETS__\r"
"GETM__\r"
"GETM__?\r"
"GETP__\r"
"GETP__?\r"
"GPAL__\r"
"VOLT__?\r"
"CURR__?\r"
"SOVP__?\r"
"SOUT__1\r"
"SOUT__0\r"
"POWW__?\r"
"POWW__?\r"
"PROM__?\r"
"PROP__?\r"
"RUNM__?\r"
"RUNP_... | |
Add missing file for ARCH = AVR. | /*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (C) 2007-2011 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute... | |
Remove commit and rollback method | #pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_
#include <cstdint>
#include <functional>
#include <unordered_map>
#include "pugixml.hpp"
namespace You {
namespace DataStore {
class DataStore {
public:
/// Test classes
friend class DataStoreAPITest;
/// typedefs
/// typedef fo... | #pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_
#include <cstdint>
#include <functional>
#include <unordered_map>
#include "pugixml.hpp"
namespace You {
namespace DataStore {
class DataStore {
public:
/// Test classes
friend class DataStoreAPITest;
/// typedefs
/// typedef fo... |
Use g_value_clear as clear function | /*
* Copyright © 2015 Canonical Limited
*
* 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 licence, or (at your option) any later version.
*
* This librar... | /*
* Copyright © 2015 Canonical Limited
*
* 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 licence, or (at your option) any later version.
*
* This librar... |
Add a generic rack-pinion steering subsystem. | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of th... | |
Add flag to stage api change am: f83df73740 | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
#define GR_TEST_UTILS 1
#define SK_BUILD_FOR_ANDROID_FRAMEWORK
#define SK_DEFAULT_FONT_CACHE_LIMIT ... | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
#define GR_TEST_UTILS 1
#define SK_BUILD_FOR_ANDROID_FRAMEWORK
#define SK_DEFAULT_FONT_CACHE_LIMIT ... |
Fix warnings in one of the tests. | #include <traildb.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char** argv)
{
((void) argc);
((void) argv);
for ( int i1 = 0; i1 < 10000; ++i1 )
{
uint8_t hex_uuid[33];
uint8_t hex_uuid2[33];
uint8_t uuid[16];
uint... | #include <traildb.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char** argv)
{
((void) argc);
((void) argv);
for ( int i1 = 0; i1 < 10000; ++i1 )
{
uint8_t hex_uuid[33];
uint8_t hex_uuid2[33];
uint8_t uuid[16];
uint... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.