Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Replace <MacHeaders> by specific required header files | #include <MacHeaders>
#include <string.h>
/* Interface used by tokenizer.c */
guesstabsize(path)
char *path;
{
char s[256];
int refnum;
Handle h;
int tabsize = 0;
s[0] = strlen(path);
strncpy(s+1, path, s[0]);
refnum = OpenResFile(s);
/* printf("%s --> refnum=%d\n", path, refnum); */
if (refnum == -1)
retu... | #include <Types.h>
#include <Files.h>
#include <OSUtils.h>
#include <Resources.h>
#include <string.h>
/* Interface used by tokenizer.c */
guesstabsize(path)
char *path;
{
char s[256];
int refnum;
Handle h;
int tabsize = 0;
s[0] = strlen(path);
strncpy(s+1, path, s[0]);
refnum = OpenResFile(s);
/* printf("%s ... |
Use fprintf() to ensure message printing | /* 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'... |
Fix copy/paste error in header guard | /*=========================================================================
Program: Visomics
Copyright (c) Kitware, 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://ww... | /*=========================================================================
Program: Visomics
Copyright (c) Kitware, 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://ww... |
Mark OS X only implementations in BrowserMainParts. | // Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_
#include "brightray/browser/browser_main_parts.h"
namespace atom ... | // Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_
#include "brightray/browser/browser_main_parts.h"
namespace atom ... |
Update MiniGraph to work with FlowGraphWidet. | #pragma once
#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtWidgets/QWidget>
#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "uitypes.h"
class ContextMenuManager;
class DisassemblyView;
class Menu;
class ViewFrame;
class BINARYNINJAUIAPI MiniGraph: public QWidget, public DockCon... | #pragma once
#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtWidgets/QWidget>
#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "uitypes.h"
class ContextMenuManager;
class FlowGraphWidget;
class Menu;
class ViewFrame;
class BINARYNINJAUIAPI MiniGraph: public QWidget, public DockCon... |
Disable scanf interceptor on windows. | //===-- sanitizer_platform_interceptors.h -----------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===-- sanitizer_platform_interceptors.h -----------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Include nearby object protocol file | //
// NearbyObjectProtocol.h
// ARIS
//
// Created by Brian Deith on 5/15/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
enum {
NearbyObjectNPC = 1,
NearbyObjectItem = 2,
NearbyObjectNode = 3
};
typedef UInt32 nearbyObjectKind;
@protocol NearbyObjectProtocol
- (NSString *)name;
- (nearb... | |
Reorganize and reduce visibility for raw XML access methods | #pragma once
#include <unordered_map>
#include <string>
#include "TinyXml2\tinyxml2.h"
class Skin;
#define SETTINGS_APP L"SettingsUI.exe"
class Settings {
public:
static Settings *Instance();
static std::wstring AppDir();
static std::wstring SettingsApp();
std::wstring LanguagesDir();
std::ws... | #pragma once
#include <unordered_map>
#include <string>
#include "TinyXml2\tinyxml2.h"
class Skin;
#define SETTINGS_APP L"SettingsUI.exe"
class Settings {
public:
static Settings *Instance();
void Reload();
static std::wstring AppDir();
static std::wstring SettingsApp();
std::wstring Language... |
Add script to test install | #include <cblas.h>
#include <stdio.h>
void main()
{
double A[ 6 ] = { 1.0, 2.0, 1.0, -3.0, 4.0, -1.0 };
double B[ 6 ] = { 1.0, 2.0, 1.0, -3.0, 4.0, -1.0 };
double C[ 9 ] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
int i = 0;
cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans, 3, 3, 2, 1, A, 3, B, 3, 2, ... | |
Add regression test where unprotected read must forget relation | // PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>
int g = 1;
void *t_fun(void *arg) {
g = 2; // write something non-initial so base wouldn't find success
return NULL;
}
int main(void) {
int x, y;
pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);
x = g;
y = g;
/... | |
Move more stuff to eigen helper header | #ifndef EIGEN_HELPER_H
#define EIGEN_HELPER_H
#include <Eigen/Dense>
template<typename Derived>
inline bool isFucked(const Eigen::MatrixBase<Derived>& x)
{
return !((x.array() == x.array())).all() && !( (x - x).array() == (x - x).array()).all();
}
#endif
| #ifndef EIGEN_HELPER_H
#define EIGEN_HELPER_H
#include "ros/ros.h"
#include <Eigen/Dense>
template<typename Derived>
inline bool isFucked(const Eigen::MatrixBase<Derived>& x)
{
return !((x.array() == x.array())).all() && !( (x - x).array() == (x - x).array()).all();
}
inline Eigen::MatrixXd getMatrixParam(ros::Nod... |
Add more simple taint tests. | // RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.taint,experimental.security.ArrayBoundV2 -verify %s
int scanf(const char *restrict format, ...);
int getchar(void);
#define BUFSIZE 10
int Buffer[BUFSIZE];
void bufferFoo1(void)
{
int n;
scanf("%d", &n);
Buffer[n] = 1; // expected-warning {{O... | // RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.taint,experimental.security.ArrayBoundV2 -verify %s
int scanf(const char *restrict format, ...);
int getchar(void);
#define BUFSIZE 10
int Buffer[BUFSIZE];
void bufferScanfDirect(void)
{
int n;
scanf("%d", &n);
Buffer[n] = 1; // expected-warn... |
Define target value types in a form usable by target-independent code | //===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
//
// This file defines the set of low-level target independent types which various
// values in the code generator are. This allows the target specific behavior
// of instructions to be described to target independent passes.
//
//===---... | |
Add CompilerBarrier() and MemoryBarrier() functions. | // 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_
#define UNLIKELY(x) __builtin_expect((x), 0)
... | // 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_
#define UNLIKELY(x) __builtin_expect((x), 0)
... |
Add empty string to exit words | #include "input.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
void read_line(char *p)
{
if (fgets(p, MAX_SIZE, stdin) == NULL){
p[0] = '\0';
return;
}
remove_space(p);
}
int is_exit(const char* p)
{
const char* exit_words[] = {
"exit",
"quit",
"b... | #include "input.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
void read_line(char *p)
{
if (fgets(p, MAX_SIZE, stdin) == NULL){
p[0] = '\0';
return;
}
remove_space(p);
}
int is_exit(const char* p)
{
const char* exit_words[] = {
"",
"exit",
"quit"... |
Update files, Alura, Introdução a C - Parte 2, Aula 2.2 | #include <stdio.h>
int main() {
int notas[10];
notas[0] = 10;
notas[2] = 9;
notas[3] = 8;
notas[9] = 4;
printf("%d %d %d\n", notas[0], notas[2], notas[9]);
} | #include <stdio.h>
int main() {
char palavrasecreta[20];
sprintf(palavrasecreta, "MELANCIA");
printf("%s\n", palavrasecreta);
/*
palavrasecreta[0] = 'M';
palavrasecreta[1] = 'E';
palavrasecreta[2] = 'L';
palavrasecreta[3] = 'A';
palavrasecreta[4] = 'N';
palavrasecreta[5] = 'C';
palavrasecreta[... |
Add cgltf_parse_file and cgltf_load_buffers to test program |
#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"
#include <stdio.h>
int main(int argc, char** argv)
{
if (argc < 2)
{
printf("err\n");
return -1;
}
FILE* f = fopen(argv[1], "rb");
if (!f)
{
return -2;
}
fseek(f, 0, SEEK_END);
long size = ftell(f);
fseek(f, 0, SEEK_SET);
void* buf = malloc(size... |
#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"
#include <stdio.h>
int main(int argc, char** argv)
{
if (argc < 2)
{
printf("err\n");
return -1;
}
cgltf_options options = {0};
cgltf_data* data = NULL;
cgltf_result result = cgltf_parse_file(&options, argv[1], &data);
if (result == cgltf_result_succes... |
Remove an unneeded header and forward declaration | //===-- PPC32TargetMachine.h - PowerPC/Darwin TargetMachine ---*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===------------... | //===-- PPC32TargetMachine.h - PowerPC/Darwin TargetMachine ---*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===------------... |
Fix U32 and S32 on LP64 architectures. | /*
Mace - http://www.macehq.cx
Copyright 1999-2004
See the file README for more information
*/
#ifndef GLOBALS_H
#define GLOBALS_H
#ifndef _MaceTypes
#define _MaceTypes
typedef unsigned char U8;
typedef char S8;
typedef unsigned short U16;
typedef signed short S16;
//Note: on 64-bit machines, replace "long" wi... | /*
Mace - http://www.macehq.cx
Copyright 1999-2004
See the file README for more information
*/
#ifndef GLOBALS_H
#define GLOBALS_H
#ifndef _MaceTypes
#define _MaceTypes
typedef unsigned char U8;
typedef signed char S8;
typedef unsigned short U16;
typedef signed short S16;
//Note: on 64-bit machines, replace "l... |
Add test for signed wrap-around with ana.int.wrap_on_signed_overflow | //PARAM: --disable ana.int.interval --enable ana.int.wrap_on_signed_overflow
#include <assert.h>
int main(){
int a = 0;
// maximum value for long long
signed long long s = 9223372036854775807;
assert(s > 9223372036854775806);
signed long long t = s + 2;
// Signed overflow - The following asse... | |
Add workaround for broken builders | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef DISABLE_OPTIMIZE_H
#define DISABLE_OPTIMIZE_H 1
/* avoid wasting time trying to optimize those countless test functions */
#if defined(__clang__)
/*
* Works for Alk since clang-3.5.
* Unfortunately it looks like Apple have their ... | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef DISABLE_OPTIMIZE_H
#define DISABLE_OPTIMIZE_H 1
/* According to MB-11846 we have some misconfigured vm's unable to
* compile the source code without enabling optimization. Add a workaround
* for those vm's until they're fixed
*/
#... |
Initialize DeviceFuncs::ifuncs_ to zero in constructor | // Copyright (c) 2010 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 PPAPI_CPP_MODULE_IMPL_H_
#define PPAPI_CPP_MODULE_IMPL_H_
#include "ppapi/cpp/module.h"
namespace {
template <typename T> class DeviceFuncs... | // Copyright (c) 2010 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 PPAPI_CPP_MODULE_IMPL_H_
#define PPAPI_CPP_MODULE_IMPL_H_
#include "ppapi/cpp/module.h"
namespace {
template <typename T> class DeviceFuncs... |
Add xhtml-im and w3c xhtml namespace |
#define WOCKY_XMPP_NS_STREAM \
(const gchar *)"http://etherx.jabber.org/streams"
#define WOCKY_XMPP_NS_TLS \
(const gchar *)"urn:ietf:params:xml:ns:xmpp-tls"
#define WOCKY_XMPP_NS_SASL_AUTH \
(const gchar *)"urn:ietf:params:xml:ns:xmpp-sasl"
|
#define WOCKY_XMPP_NS_STREAM \
(const gchar *)"http://etherx.jabber.org/streams"
#define WOCKY_XMPP_NS_TLS \
(const gchar *)"urn:ietf:params:xml:ns:xmpp-tls"
#define WOCKY_XMPP_NS_SASL_AUTH \
(const gchar *)"urn:ietf:params:xml:ns:xmpp-sasl"
#define WOCKY_XMPP_NS_XHTML_IM \
(const gchar *)"http://jabber.org... |
Update header comment to reflect the current state of the source. | //
// Copyright (c) 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... | //
// Copyright (c) 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
Copy constructor added to Login class | /**
* The login information to access a server
*
* This class combines login, password and vhost
*
* @copyright 2014 Copernica BV
*/
/**
* Set up namespace
*/
namespace AMQP {
/**
* Class definition
*/
class Login
{
private:
/**
* The username
* @var string
*/
std::string _user... | /**
* The login information to access a server
*
* This class combines login, password and vhost
*
* @copyright 2014 Copernica BV
*/
/**
* Set up namespace
*/
namespace AMQP {
/**
* Class definition
*/
class Login
{
private:
/**
* The username
* @var string
*/
std::string _user... |
Remove special cxxmodules case now that gVersionCheck is on ROOT::. | // @(#)root/base:$Id$
// Author: Fons Rademakers 9/5/2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... | // @(#)root/base:$Id$
// Author: Fons Rademakers 9/5/2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... |
Support Pre 0.40 and Post 0.40 React Native. | //
// RNUnifiedContacts.h
// RNUnifiedContacts
//
// Created by Joshua Pinter on 2016-03-23.
// Copyright © 2016 Joshua Pinter. All rights reserved.
//
#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h
#import <React/RCTBridgeModule.h>
#endif /* RNUnifiedContacts_Bridging_He... | //
// RNUnifiedContacts.h
// RNUnifiedContacts
//
// Created by Joshua Pinter on 2016-03-23.
// Copyright © 2016 Joshua Pinter. All rights reserved.
//
#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h
#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#... |
Make IOperation destructor virtual, remove redundant default | #pragma once
#ifndef YOU_DATASTORE_OPERATION_H_
#define YOU_DATASTORE_OPERATION_H_
#include <unordered_map>
#include "datastore.h"
namespace You {
namespace DataStore {
/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
IOperation() = default;
~IOperation() = default... | #pragma once
#ifndef YOU_DATASTORE_OPERATION_H_
#define YOU_DATASTORE_OPERATION_H_
#include <unordered_map>
#include "datastore.h"
namespace You {
namespace DataStore {
/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
IOperation();
virtual ~IOperation();
/// Exec... |
Remove two unused PPAPI-related typedefs | /*
* Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_
#define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_ 1
#include <stddef.h>
#include... | /*
* Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_
#define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_ 1
#include <stddef.h>
#include... |
Add newline at end of file, clang compiler warning. | //===-- GetOpt.h ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===-- GetOpt.h ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Fix a typo (thanks to Robert Hatcher) | // @(#)root/hist:$Name: $:$Id: TH1I.h,v 1.1 2002/05/18 11:02:49 brun Exp $
// Author: Rene Brun 08/09/2003
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. ... | // @(#)root/hist:$Name: $:$Id: TH1I.h,v 1.1 2003/09/08 12:50:23 brun Exp $
// Author: Rene Brun 08/09/2003
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. ... |
Mark init as unavailable for ObjectStore | // For License please refer to LICENSE file in the root of FastEasyMapping project
#import "FEMObjectStore.h"
@class NSManagedObjectContext;
@interface FEMManagedObjectStore : FEMObjectStore
- (nonnull instancetype)initWithContext:(nonnull NSManagedObjectContext *)context NS_DESIGNATED_INITIALIZER;
@property (nonat... | // For License please refer to LICENSE file in the root of FastEasyMapping project
#import "FEMObjectStore.h"
NS_ASSUME_NONNULL_BEGIN
@class NSManagedObjectContext;
@interface FEMManagedObjectStore : FEMObjectStore
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithContext:(NSManagedObjectContext *)cont... |
Add empty header to fix internal project. | /*
* Copyright 2017 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 macros for targeting Windows XP | /* Various definitions needed for compatibility with various
compilers (MSC) and platforms (Windows). */
#ifndef BASE_DEFS_H
#define BASE_DEFS_H
#ifdef _MSC_VER
#if !defined(__cplusplus)
#define inline __inline
#endif
#define __attribute__(x)
#endif
#ifdef _WIN32
/* Target Windows XP */
#define WINVER 0x0501
#... | |
Fix comment on shouldSkipAuthorization property | /* Copyright (c) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | /* Copyright (c) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Add a sample program for testing memory search. | //Compile this program with -O0
#include <stdlib.h>
#include <unistd.h>
int main(void) {
char *in_data_segment[] = "0xC0xA0xF0xE";
char in_stack[] = {0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf};
char *in_heap = malloc(7 * sizeof(char));
in_heap[0] = 0xb;
in_heap[1] = 0xe;
in_heap[2] = 0xb;
in... | |
Include <stdint.h> for MS Visual Studio 2010 and above | #ifndef _MATH_MT_H_
#define _MATH_MT_H_
//#if defined(_MSC_VER) && (_MSC_VER <= 1600) // sufficient
#if defined(_MSC_VER) // better?
typedef unsigned __int32 uint32_t;
#elif defined(__linux__) || defined(__GLIBC__) || defined(__WIN32__) || defined(__APPLE__)
#include <stdint.h>
#elif defined(__... | #ifndef _MATH_MT_H_
#define _MATH_MT_H_
#if defined(_MSC_VER) && (_MSC_VER < 1600) // for MS Visual Studio prior to 2010
typedef unsigned __int32 uint32_t;
#elif defined(__linux__) || defined(__GLIBC__) || defined(__WIN32__) || defined(_MSC_VER) || defined(__APPLE__)
#include <stdint.h>
#elif defined(__osf__)
#include... |
Add preprocessor if check example | /**
* Copyright (c) 2015, Trellis-Logic
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions an... | |
Allow version suffix from command line | #ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H
#include <QString>
/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 4
/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGrou... | #ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H
#include <QString>
/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 4
/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGrou... |
Add cookie entry for auxilary match data. | #ifndef CJET_FETCH_H
#define CJET_FETCH_H
#include "json/cJSON.h"
#include "list.h"
#include "peer.h"
typedef int (*match_func)(const char *fetch_path, const char *state_path);
struct path_matcher {
char *fetch_path;
match_func match_function;
};
struct fetch {
char *fetch_id;
const struct peer *peer;
struct l... | #ifndef CJET_FETCH_H
#define CJET_FETCH_H
#include "json/cJSON.h"
#include "list.h"
#include "peer.h"
typedef int (*match_func)(const char *fetch_path, const char *state_path);
struct path_matcher {
char *fetch_path;
match_func match_function;
uintptr_t cookie;
};
struct fetch {
char *fetch_id;
const struct pe... |
Fix compilation broken for linux |
#ifndef _H_STREAM_QUEUE_MANAGER
#define _H_STREAM_QUEUE_MANAGER
/* ****************************************************************************
*
* FILE QueuesManager.h
*
* AUTHOR Andreu Urruela Planas
*
* All the queues contained in the system
*
*/
#include "au/map.... |
#ifndef _H_STREAM_QUEUE_MANAGER
#define _H_STREAM_QUEUE_MANAGER
/* ****************************************************************************
*
* FILE QueuesManager.h
*
* AUTHOR Andreu Urruela Planas
*
* All the queues contained in the system
*
*/
#include "au/map.... |
Add missing part of test | template <typename T> struct S;
template<typename T> void c(T)
{
}
template <> struct S <int>
{
void a()
{
c(&S<int>::b);
}
void b() {}
};
| |
Change forward declaration to import for convenience. | //
// OCHamcrest - HCSelfDescribing.h
// Copyright 2013 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
@protocol HCDescription;
/**
The... | //
// OCHamcrest - HCSelfDescribing.h
// Copyright 2013 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Docs: http://hamcrest.github.com/OCHamcrest/
// Source: https://github.com/hamcrest/OCHamcrest
//
#import <Foundation/Foundation.h>
#import "HCDescription.h"
/**
Th... |
Fix symFileVersion not being initialized in ArmipsArguments constructor | #pragma once
#include "../Util/FileClasses.h"
#include "../Util/Util.h"
#include "FileManager.h"
#define ARMIPS_VERSION_MAJOR 0
#define ARMIPS_VERSION_MINOR 10
#define ARMIPS_VERSION_REVISION 0
enum class ArmipsMode { FILE, MEMORY };
struct LabelDefinition
{
std::wstring name;
int64_t value;
};
struct Equat... | #pragma once
#include "../Util/FileClasses.h"
#include "../Util/Util.h"
#include "FileManager.h"
#define ARMIPS_VERSION_MAJOR 0
#define ARMIPS_VERSION_MINOR 10
#define ARMIPS_VERSION_REVISION 0
enum class ArmipsMode { FILE, MEMORY };
struct LabelDefinition
{
std::wstring name;
int64_t value;
};
struct Equat... |
Use __attribute__s if __GNUC__ defined | /* Copyright 2014-2015 Drew Thoreson
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _COMPILER_H
#define _COMPILER_H
#if __STDC_VERSION__ < 201112L
#... | /* Copyright 2014-2015 Drew Thoreson
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _COMPILER_H
#define _COMPILER_H
#if __STDC_VERSION__ < 201112L
#... |
Add missing word in comment | //PARAM: --enable witness.yaml.enabled --enable ana.int.interval
#include <stdlib.h>
int foo(int* ptr1, int* ptr2){
int result;
if(ptr1 == ptr2){
result = 0;
} else {
result = 1;
}
// Look at the generated witness.yml to check whether there contradictory precondition_loop_invariant[... | //PARAM: --enable witness.yaml.enabled --enable ana.int.interval
#include <stdlib.h>
int foo(int* ptr1, int* ptr2){
int result;
if(ptr1 == ptr2){
result = 0;
} else {
result = 1;
}
// Look at the generated witness.yml to check whether there are contradictory precondition_loop_invari... |
Fix arguments count check in test inotify program | /*
This is a simple C program which is a stub for the FS monitor.
It takes one argument which would be a directory to monitor. In this case,
the filename is discarded after argument validation.
Every minute the
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main (int argc, char **a... | /*
This is a simple C program which is a stub for the FS monitor.
It takes one argument which would be a directory to monitor. In this case,
the filename is discarded after argument validation.
Every minute the
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main (int argc, char **a... |
Add a missing file... fix that compile error. | /***************************************************************************
* Copyright (C) 2006 *
* *
* Jason Kivlighn (jkivlighn@gmail.com) *
* ... | |
Add TODO test where ambiguous pointer invariant could refine pointer | // modified from 27/09
#include <assert.h>
int main() {
int a = 1;
int b = 1;
int *x;
int rnd;
if (rnd)
x = &a;
else
x = &b;
assert(*x == 1);
b = 2;
assert(a == 1);
if (*x > 1) { // invariant rules out x == &a
assert(x == &b); // TODO
assert(*x == 2); // TODO
}
return 0;
} | |
Make sure we've enabled interrupts before calling halt.. | /*
* Part of Jari Komppa's zx spectrum suite
* https://github.com/jarikomppa/speccy
* released under the unlicense, see http://unlicense.org
* (practically public domain)
*/
// xxxsmbbb
// where b = border color, m is mic, s is speaker
void port254(const unsigned char color) __z88dk_fastcall
{
color; // color... | /*
* Part of Jari Komppa's zx spectrum suite
* https://github.com/jarikomppa/speccy
* released under the unlicense, see http://unlicense.org
* (practically public domain)
*/
// xxxsmbbb
// where b = border color, m is mic, s is speaker
void port254(const unsigned char color) __z88dk_fastcall
{
color; // color... |
Use Framework style import statements for pod Framework compatibility | //
// SGCachePromise.h
// Pods
//
// Created by James Van-As on 13/05/15.
//
//
#import "Promise.h"
#import "MGEvents.h"
typedef void(^SGCacheFetchCompletion)(id obj);
typedef void(^SGCacheFetchFail)(NSError *error, BOOL wasFatal);
typedef void(^SGCacheFetchOnRetry)();
@interface SGCachePromise : PMKPromise
@prop... | //
// SGCachePromise.h
// Pods
//
// Created by James Van-As on 13/05/15.
//
//
#import <PromiseKit/Promise.h>
#import <MGEvents/MGEvents.h>
typedef void(^SGCacheFetchCompletion)(id obj);
typedef void(^SGCacheFetchFail)(NSError *error, BOOL wasFatal);
typedef void(^SGCacheFetchOnRetry)();
@interface SGCachePromis... |
Test case distilled from sed. | typedef enum { FALSE, TRUE } flagT;
struct Word
{
short bar;
short baz;
flagT final:1;
short quux;
} *word_limit;
void foo ()
{
word_limit->final = (word_limit->final && word_limit->final);
}
| |
Make this a proper forwarding header rather than a duplication what's under pagespeed/util/ | /*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | /*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Update RingOpenGL 1.1 - Add Constant (Source Code) : GL_FALSE | #include "ring.h"
/*
OpenGL 1.1 Extension
Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/
#include <GL/glew.h>
#include <GL/glut.h>
RING_FUNC(ring_get_gl_zero)
{
RING_API_RETNUMBER(GL_ZERO);
}
RING_API void ringlib_init(RingState *pRingState)
{
ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
... | #include "ring.h"
/*
OpenGL 1.1 Extension
Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/
#include <GL/glew.h>
#include <GL/glut.h>
RING_FUNC(ring_get_gl_zero)
{
RING_API_RETNUMBER(GL_ZERO);
}
RING_FUNC(ring_get_gl_false)
{
RING_API_RETNUMBER(GL_FALSE);
}
RING_API void ringlib_init(RingState *pRin... |
Debug macro for seeding random generator. | // CppUtils.h
#pragma once
#include <algorithm>
#include <functional>
#include <vector>
#include <random>
using namespace System;
namespace CppUtils {
public ref class Random
{
public:
double Random::random_double()
{
return Random::random_in_range(0.0, 1.0);
}
do... | // CppUtils.h
#pragma once
#ifdef DEBUG
#define SEED(x) 100
#else
#define SEED(x) x
#endif
#include <algorithm>
#include <functional>
#include <vector>
#include <random>
using namespace System;
namespace CppUtils {
public ref class Random
{
public:
double Random::random_double()
{
... |
Add a RUN line to get a hint on why the test is failing at the buildbots. | // This uses a headermap with this entry:
// someheader.h -> Product/someheader.h
// RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H 2> %t.out
// RUN: FileCheck %s -input-file %t.out
// CHECK: Product/som... | // This uses a headermap with this entry:
// someheader.h -> Product/someheader.h
// RUN: %clang_cc1 -v -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H
// RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/... |
Delete printing, show usage if arguments are not enough | #include "estimator.h"
#include <stdio.h>
int main(int argc, char** argv) {
void* estimator = create_estimator(argv[1]);
candidates_t* candidates = estimate(estimator, argv[2]);
for(unsigned int i = 0; i < candidates->candidates[0]->size; i++) {
printf("x: %4lu y: %4lu confidence: %.4f \n",
... | #include <stdio.h>
#include <stdlib.h>
#include "estimator.h"
int main(int argc, char** argv) {
//test();
if(argc < 3) {
printf("Usage: PartsBasedDetector1 model_file image_file\n");
exit(0);
}
void* estimator = create_estimator(argv[1]);
candidates_t* candidates = estimate(esti... |
Remove compiler warning due to old-style function definition | /* Copyright (C) 2003 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) 2003 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... |
Increase the size of the read buffer fpo testing. | #ifndef CJET_CONFIG_H
#define CJET_CONFIG_H
#define SERVER_PORT 11122
#define LISTEN_BACKLOG 40
#define MAX_MESSAGE_SIZE 128
/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100
#endif
| #ifndef CJET_CONFIG_H
#define CJET_CONFIG_H
#define SERVER_PORT 11122
#define LISTEN_BACKLOG 40
#define MAX_MESSAGE_SIZE 250
/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100
#endif
|
Make ports constexpr to further reduce binary size | /*
* atlstd.h
*
* Created: 3/31/2017 12:29:59 AM
* Author: Vadim Zabavnov
*/
#ifndef ATLSTD_H_
#define ATLSTD_H_
#include <atlport.h>
namespace atl {
namespace std {
using namespace atl;
// standard ports
#ifdef PORTA
const Port PortA = Port(_SFR_IO_ADDR(PORTA), _SFR_IO_ADDR(DDRA), _SFR_IO_ADDR(PINA));
#en... | /*
* atlstd.h
*
* Created: 3/31/2017 12:29:59 AM
* Author: Vadim Zabavnov
*/
#ifndef ATLSTD_H_
#define ATLSTD_H_
#include <atlport.h>
namespace atl {
namespace std {
using namespace atl;
// standard ports
#ifdef PORTA
constexpr Port PortA = Port(_SFR_IO_ADDR(PORTA), _SFR_IO_ADDR(DDRA), _SFR_IO_ADDR(PINA));... |
Add minor comment for log_open | // cc log_example.c log.c
#include "log.h"
int main(int argc, const char *argv[])
{
log_open("example", NULL, 0);
/* set log level to info, also the default level */
log_setlevel(LOG_INFO);
/* debug mesage won't be seen */
log_debug("debug message");
/* but info and warn message can be seen */... | // cc log_example.c log.c
#include "log.h"
int main(int argc, const char *argv[])
{
/* open global logger to stderr (by setting filename to NULL) */
log_open("example", NULL, 0);
/* set log level to info, also the default level */
log_setlevel(LOG_INFO);
/* debug mesage won't be seen */
log_de... |
Integrate terminal renderer for testing | #include <stdio.h>
#include <stdlib.h>
#include "apricosterm.h"
#include "screen.h"
int main(int argc, char** argv) {
SDL_Event event;
initScreen("Potato", SCREEN_WIDTH, SCREEN_HEIGHT);
char done = 0;
while(!done) {
while(SDL_PollEvent(&event)) {
switch(event.key.keysym.sym) {
... | #include <stdio.h>
#include <stdlib.h>
#include "apricosterm.h"
#include "screen.h"
#include "terminalrenderer.h"
#include "managedtextures.h"
int main(int argc, char** argv) {
SDL_Event event;
initScreen("Potato", SCREEN_WIDTH, SCREEN_HEIGHT);
char done = 0;
termRendererInit();
SDL_StartTextInput... |
Work on stash retrieval, memory allocation | /**
* repo.c
*
* Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
*/
#include "repo.h"
/**
* Get all stashes for a repository.
*/
struct stash *get_stashes (struct repo *r) {
return r->stashes;
}
/**
* Set a copy of all stashes for a repository in memory.
*/
void set_stashes (struct repo *r) {
// ... | /**
* repo.c
*
* Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
*/
#include "repo.h"
/**
* Get all stash entries for a repository.
*/
struct stash *get_stash (struct repo *r) {
return r->stash;
}
/**
* Set a copy of all stash entries for a repository.
*/
void set_stash (struct repo *r) {
char *cm... |
Add buttons for driving, and swap intake and arm buttons | task usercontrol(){
int DY, DT;
bool armsLocked = false;
while(true){
//Driving
DY = threshold(PAIRED_CH2, 15);
DT = threshold(PAIRED_CH1, 15);
drive(DY, DT);
//Pistons (toggle)
if(PAIRED_BTN7R){
pistons(!PISTON_POS);
waitUntil(!PAIRED_BTN7R);
}
//Arms
if(PAIRED_BTN7L){
armsLocked = !ar... | task usercontrol(){
int DY, DT;
bool armsLocked = false;
while(true){
//Driving
DY = threshold(PAIRED_CH2, 15) + (PAIRED_BTN8U * MAX_POWER) - (PAIRED_BTN8D * MAX_POWER);
DT = threshold(PAIRED_CH1, 15) + (PAIRED_BTN8R * MAX_POWER) - (PAIRED_BTN8L * MAX_POWER);
drive(DY, DT);
//Pistons (toggle)
if(PAIRED... |
Use weak attribute for the autocompleteDelegate property of SMLTextView. | //
// SMLTextViewPrivate.h
// Fragaria
//
// Created by Daniele Cattaneo on 26/02/15.
//
//
#import <Cocoa/Cocoa.h>
#import "SMLTextView.h"
#import "SMLAutoCompleteDelegate.h"
@interface SMLTextView ()
/** The autocomplete delegate for this text view. This property is private
* because it is set to an internal... | //
// SMLTextViewPrivate.h
// Fragaria
//
// Created by Daniele Cattaneo on 26/02/15.
//
//
#import <Cocoa/Cocoa.h>
#import "SMLTextView.h"
#import "SMLAutoCompleteDelegate.h"
@interface SMLTextView ()
/** The autocomplete delegate for this text view. This property is private
* because it is set to an internal... |
Use vpx_integer.h instead of stdint.h | /*
* Copyright (c) 2012 The WebM 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 contributin... | /*
* Copyright (c) 2012 The WebM 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 contributin... |
Allow setting user id/hmac key via command line params for setpin | #ifndef COMMAND_LINE_FLAGS_H_
#define COMMAND_LINE_FLAGS_H_
#include "kinetic/kinetic.h"
#include "gflags/gflags.h"
DEFINE_string(host, "localhost", "Kinetic Host");
DEFINE_uint64(port, 8123, "Kinetic Port");
DEFINE_uint64(timeout, 30, "Timeout");
void parse_flags(int *argc, char*** argv, std::unique_ptr<kinetic::C... | #ifndef COMMAND_LINE_FLAGS_H_
#define COMMAND_LINE_FLAGS_H_
#include "kinetic/kinetic.h"
#include "gflags/gflags.h"
DEFINE_string(host, "localhost", "Kinetic Host");
DEFINE_uint64(port, 8123, "Kinetic Port");
DEFINE_uint64(timeout, 30, "Timeout");
DEFINE_uint64(user_id, 1, "Kinetic User ID");
DEFINE_string(hmac_key,... |
Replace MPI source code instead of executive binary file. User will compile the source with its own mpi implementation. |
#include <stdlib.h>
#include <stdio.h>
#include <mpi.h>
main(int argc, char **argv)
{
register double width;
double sum = 0, lsum;
register int intervals, i;
int nproc, iproc;
MPI_Win sum_win;
if (MPI_Init(&argc, &argv) != MPI_SUCCESS) exit(1);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
MPI_Comm_rank(MP... | |
Set tempdir to null by default | #pragma once
#include <QObject>
#include <QProcess>
#include <QString>
#include "Config/AmigaUAEConfig.h"
class QTemporaryDir;
namespace prodbg {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class AmigaUAE : public QObject
{
Q_OBJECT
... | #pragma once
#include <QObject>
#include <QProcess>
#include <QString>
#include "Config/AmigaUAEConfig.h"
class QTemporaryDir;
namespace prodbg {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class AmigaUAE : public QObject
{
Q_OBJECT
... |
Fix missing PopupAt overrides on windows/linux | // Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#include <map>
#include <memory>
#include "atom/browser/api/atom_api_menu.h"
#include ... | // Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#include <map>
#include <memory>
#include "atom/browser/api/atom_api_menu.h"
#include ... |
Make instructions / cycle counters more useful | #pragma once
template<typename B, typename R> static void ParseRecordsBenchmark(benchmark::State &state, const simdjson::padded_string &json) {
// Warmup and equality check (make sure the data is right!)
B bench;
bench.SetUp();
if (!bench.Run(json)) { state.SkipWithError("warmup tweet reading failed"); return;... | #pragma once
template<typename B, typename R> static void ParseRecordsBenchmark(benchmark::State &state, const simdjson::padded_string &json) {
// Warmup and equality check (make sure the data is right!)
B bench;
bench.SetUp();
if (!bench.Run(json)) { state.SkipWithError("warmup tweet reading failed"); return;... |
Fix methods return type ampersand location (NFC) | //===--- Algorithm.h - ------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LI... | //===--- Algorithm.h - ------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LI... |
Add test for path-sensitive uninit-val detection involving struct field. | // RUN: clang -checker-simple -verify %s
struct FPRec {
void (*my_func)(int * x);
};
int bar(int x);
int f1_a(struct FPRec* foo) {
int x;
(*foo->my_func)(&x);
return bar(x)+1; // no-warning
}
int f1_b() {
int x;
return bar(x)+1; // expected-warning{{Pass-by-value argument in function is undefined.}}
... | // RUN: clang -checker-simple -verify %s
struct FPRec {
void (*my_func)(int * x);
};
int bar(int x);
int f1_a(struct FPRec* foo) {
int x;
(*foo->my_func)(&x);
return bar(x)+1; // no-warning
}
int f1_b() {
int x;
return bar(x)+1; // expected-warning{{Pass-by-value argument in function is undefined.}}
... |
Allow passing ints as arg | #include <stdio.h>
static
int r( int n )
{
printf("%d\n", n);
if (n <= 1)
return n;
if (n%2)
return r((n*3)+1);
return r(n/2);
}
int main ( void )
{
puts("Basic collatz fun - recursive C function");
r(15);
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
static
long r( long n )
{
printf("%ld\n", n);
if (n <= 1)
return n;
if (n%2)
return r((n*3)+1);
return r(n/2);
}
int main (int argc, char **argv)
{
long n = 15;
if (argc > 1)
n = strtol(argv[1], NULL, 10);
puts("Basic collatz f... |
Change tabs to spaces, Lets nip this one in the bud. | #include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <adm/uaccess.h>
// Module Stuff
MODULE_LICENCE("Apache"); // Change this to "GPL" if you get annoyed about
// the kernal playing a crying fit about non GPL stuff
MODULE_DESCRIPTION("A Markov device driver.");
MODULE_AUTHOR("Ben ... | #include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <adm/uaccess.h>
// Module Stuff
MODULE_LICENCE("Apache"); // Change this to "GPL" if you get annoyed about
// the kernal playing a crying fit about non GPL stuff
MODULE_DESCRIPTION("A Markov device driver.");
M... |
Remove prototypes for nonexistent functions | #ifndef ASSOC_H
#define ASSOC_H
struct assoc {
/* how many powers of 2's worth of buckets we use */
unsigned int hashpower;
/* Main hash table. This is where we look except during expansion. */
hash_item** primary_hashtable;
/*
* Previous hash table. During expansion, we look here for keys that h... | #ifndef ASSOC_H
#define ASSOC_H
struct assoc {
/* how many powers of 2's worth of buckets we use */
unsigned int hashpower;
/* Main hash table. This is where we look except during expansion. */
hash_item** primary_hashtable;
/*
* Previous hash table. During expansion, we look here for keys that h... |
Check that the gcc front-end is not doing inlining when not doing unit-at-a-time. | // RUN: %llvmgcc -S %s -O0 -o - -mllvm --disable-llvm-optzns | grep bar
// Check that the gcc inliner is turned off.
#include <stdio.h>
static __inline__ __attribute__ ((always_inline))
int bar (int x)
{
return 4;
}
void
foo ()
{
long long b = 1;
int Y = bar (4);
printf ("%d\n", Y);
}
| |
Modify void parseContents(0) as pure virtual function. | /*
* NovelProcessTool.h
*
* Created on: 2015年2月19日
* Author: nemo
*/
#ifndef SRC_NOVELPROCESSTOOL_H_
#define SRC_NOVELPROCESSTOOL_H_
#include <string>
#include <fstream>
#include <vector>
using namespace std;
class NovelProcessTool {
public:
NovelProcessTool();
virtual ~NovelProcessTool();
protected:
... | /*
* NovelProcessTool.h
*
* Created on: 2015年2月19日
* Author: nemo
*/
#ifndef SRC_NOVELPROCESSTOOL_H_
#define SRC_NOVELPROCESSTOOL_H_
#include <string>
#include <fstream>
#include <vector>
using namespace std;
class NovelProcessTool {
public:
NovelProcessTool();
virtual ~NovelProcessTool();
protected:
... |
Support WS2812Serial Library on Teensy T4 | #ifndef __INC_FASTLED_ARM_MXRT1062_H
#define __INC_FASTLED_ARM_MXRT1062_H
#include "fastpin_arm_mxrt1062.h"
#include "fastspi_arm_mxrt1062.h"
#include "clockless_arm_mxrt1062.h"
#include "block_clockless_arm_mxrt1062.h"
#endif
| #ifndef __INC_FASTLED_ARM_MXRT1062_H
#define __INC_FASTLED_ARM_MXRT1062_H
#include "fastpin_arm_mxrt1062.h"
#include "fastspi_arm_mxrt1062.h"
#include "../k20/octows2811_controller.h"
#include "../k20/ws2812serial_controller.h"
#include "../k20/smartmatrix_t3.h"
#include "clockless_arm_mxrt1062.h"
#include "block_cloc... |
Fix check the libextobjc when it is framework | //
// NSObject+ASPropertyAttributes.h
// AppScaffold Cocoa Category
//
// Created by Whirlwind on 15/4/3.
// Copyright (c) 2015年 AppScaffold. All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include("EXTRuntimeExtensions.h")
// This category need pod 'libextobjc'
#import "EXTRuntimeExtensions.... | //
// NSObject+ASPropertyAttributes.h
// AppScaffold Cocoa Category
//
// Created by Whirlwind on 15/4/3.
// Copyright (c) 2015年 AppScaffold. All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<libextobjc/EXTRuntimeExtensions.h>)
// This category need pod 'libextobjc'
#import <libextobjc... |
Create RightStick X and Y value get Function | #ifndef OI_H
#define OI_H
#include "WPILib.h"
#include "RobotMap.h"
#include <math.h>
class OI
{
private:
Joystick joystick;
public:
OI();
inline float GetXplusY(){
float val;
val = FractionOmitted(joystick.GetY() + joystick.GetX());
if(val > 1.2) val = 1.2;
if(val < -1.2) val = -1.2;
return val;
}
in... | #ifndef OI_H
#define OI_H
#include "WPILib.h"
#include "RobotMap.h"
#include <math.h>
class OI
{
private:
Joystick joystick;
public:
OI();
inline float GetXplusY(){
float val;
val = FractionOmitted(joystick.GetY() + joystick.GetX());
if(val > 1.2) val = 1.2;
if(val < -1.2) val = -1.2;
return val;
}
in... |
Remove prototype for removed function | #ifndef SDL_EVENTS_H
#define SDL_EVENTS_H
#include "common.h"
#include "gba-thread.h"
#include <SDL.h>
#define SDL_BINDING_KEY 0x53444C4B
#define SDL_BINDING_BUTTON 0x53444C42
struct GBAVideoSoftwareRenderer;
struct GBASDLEvents {
struct GBAInputMap* bindings;
SDL_Joystick* joystick;
#if SDL_VERSION_ATLEAST(2, ... | #ifndef SDL_EVENTS_H
#define SDL_EVENTS_H
#include "common.h"
#include "gba-thread.h"
#include <SDL.h>
#define SDL_BINDING_KEY 0x53444C4B
#define SDL_BINDING_BUTTON 0x53444C42
struct GBAVideoSoftwareRenderer;
struct GBASDLEvents {
struct GBAInputMap* bindings;
SDL_Joystick* joystick;
#if SDL_VERSION_ATLEAST(2, ... |
Fix silly think-o in tests. | // RUN: %clang_cc1 -triple arm64-apple-ios -O3 -emit-llvm -o - %s | FileCheck %s
void f0(void *a, void *b) {
__clear_cache(a,b);
// CHECK: call {{.*}} @__clear_cache
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
void rbit(unsigned a) {
__builtin_arm_rbit(a);
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i64... | // RUN: %clang_cc1 -triple arm64-apple-ios -O3 -emit-llvm -o - %s | FileCheck %s
void f0(void *a, void *b) {
__clear_cache(a,b);
// CHECK: call {{.*}} @__clear_cache
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
unsigned rbit(unsigned a) {
return __builtin_arm_rbit(a);
}
// CHECK: call {{.*}} @llvm.aarch... |
Add noreturn attribute to fatal_error | #ifndef UTIL_H
#define UTIL_H
#define estr(x) #x
#define ENUM(x) estr(x)
void exec_error(const char *msg, ...);
void fatal_error(const char *msg, ...);
typedef enum { FALSE, TRUE } BOOL;
#endif
| #ifndef UTIL_H
#define UTIL_H
#define estr(x) #x
#define ENUM(x) estr(x)
void exec_error(const char *msg, ...);
#ifdef _MSC_VER
__declspec(noreturn)
#endif
void fatal_error(const char *msg, ...)
#ifdef __GNUC__
__attribute__((noreturn))
#endif
;
typedef enum { FALSE, TRUE } BOOL;
#endif
|
Add the problem of 'Bugs in removeHead'. | /*
* PROBLEM
* Discuss the stack data structure. Implement a stack in C using either a linked list or a dynamic array, and justify your decision.
* Design the interface to your stack to be complete, consistent, and easy to use.
*/
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct Element ... | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct Element {
struct Element *next;
void *data;
} Element;
/*
* PROBLEM
* Discuss the stack data structure. Implement a stack in C using either a linked list or a dynamic array, and justify your decision.
* Design the interface to your ... |
Add some basic documentation for graylog_log | //
// MCGraylog.h
// MCGraylog
//
// Created by Jordan on 2013-05-06.
// Copyright (c) 2013 Marketcircle. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum {
GraylogLogLevelEmergency = 0,
GraylogLogLevelAlert = 1,
GraylogLogLevelCritical = 2,
GraylogLogLevelError = 3,
Gray... | //
// MCGraylog.h
// MCGraylog
//
// Created by Jordan on 2013-05-06.
// Copyright (c) 2013 Marketcircle. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum {
GraylogLogLevelEmergency = 0,
GraylogLogLevelAlert = 1,
GraylogLogLevelCritical = 2,
GraylogLogLevelError = 3,
Gray... |
Fix wrong bool definition in VirtIO library interface | //////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007 Qumranet All Rights Reserved
//
// Module Name:
// osdep.h
//
// Abstract:
// Windows OS dependent definitions of data types
//
// Author:
// Yan Vugenfirer - February 2007.
//
////////////////////////////... | //////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007 Qumranet All Rights Reserved
//
// Module Name:
// osdep.h
//
// Abstract:
// Windows OS dependent definitions of data types
//
// Author:
// Yan Vugenfirer - February 2007.
//
////////////////////////////... |
Make the destructor public. ddunbar, lemme know if you'd prefer a different fix, just trying to get the build bots happy again. | //===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Fix printing of names in stack dumps. | /* go-traceback.c -- stack backtrace for Go.
Copyright 2012 The Go 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 "config.h"
#include "runtime.h"
#include "go-string.h"
/* Print a stack trace for the current gorou... | /* go-traceback.c -- stack backtrace for Go.
Copyright 2012 The Go 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 "config.h"
#include "runtime.h"
#include "go-string.h"
/* Print a stack trace for the current gorou... |
Use condor_fix_signal.h, not <signal.h>, and include <sys/ioctl.h> properly. Also, NT specific changes committed to main trunk. | #include "_condor_fix_types.h"
#include "condor_fix_stdio.h"
#include <stdlib.h>
#include "condor_fix_unistd.h"
#include "condor_fix_limits.h"
#include "condor_fix_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#if !defined(SUNOS41)
#include <signal.h>
#endif
| #if defined(WIN32)
#define NOGDI
#define NOUSER
#define NOSOUND
#include <winsock2.h>
#include <windows.h>
#include "_condor_fix_nt.h"
#include <stdlib.h>
#else
#include "_condor_fix_types.h"
#include "condor_fix_stdio.h"
#include <stdlib.h>
#include "condor_fix_unistd.h"
#include "condor_fix_limits.h"
#include "con... |
Enable escape in 31/04 for global-history to pass | // PARAM: --enable ana.int.interval --enable exp.partition-arrays.enabled --set ana.activated "['base', 'mallocWrapper', 'expRelation', 'var_eq']"
int *tmp;
int main ()
{
int pathbuf[2];
int *bound = pathbuf + sizeof(pathbuf)/sizeof(*pathbuf) - 1;
int *p = pathbuf;
while (p <= bound) {
*p = 1;
p++... | // PARAM: --enable ana.int.interval --enable exp.partition-arrays.enabled --set ana.activated "['base', 'mallocWrapper', 'escape', 'expRelation', 'var_eq']"
int *tmp;
int main ()
{
int pathbuf[2];
int *bound = pathbuf + sizeof(pathbuf)/sizeof(*pathbuf) - 1;
int *p = pathbuf;
while (p <= bound) {
*p = 1... |
Add race test where all accesses don't race | #include <pthread.h>
#include <stdio.h>
int myglobal;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
return NULL;
}
void *t_fun2(void *arg) {
pthread_mutex_lock(&mutex1);
myglobal=myglobal+1; // RACE!
pthread_mutex_unlock(&mute... | |
Add TODOs for future work |
int asserter_is_false(int);
int set_empty(void);
int set_size(int);
int set_add(int, int);
int main(void)
{
// set_empty tests
if (asserter_is_false(set_empty() == 0)) return __LINE__;
// set_add tests
if (asserter_is_false(set_add(set_empty(), 0) != set_empty())) return __LINE__;
if (asserter_is_false(set_add(... |
int asserter_is_false(int);
int set_empty(void);
int set_size(int);
int set_add(int, int);
int main(void)
{
// set_empty tests
if (asserter_is_false(set_empty() == 0)) return __LINE__;
// set_add tests
if (asserter_is_false(set_add(set_empty(), 0) != set_empty())) return __LINE__;
if (asserter_is_false(set_add(... |
Change default socket path to /var/run/ | #ifndef __CR_SERVICE_H__
#define __CR_SERVICE_H__
#include "protobuf/rpc.pb-c.h"
#define CR_DEFAULT_SERVICE_ADDRESS "/tmp/criu_service.socket"
#define MAX_MSG_SIZE 1024
int cr_service(bool deamon_mode);
int send_criu_dump_resp(int socket_fd, bool success, bool restored);
extern struct _cr_service_client *cr_servic... | #ifndef __CR_SERVICE_H__
#define __CR_SERVICE_H__
#include "protobuf/rpc.pb-c.h"
#define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket"
#define MAX_MSG_SIZE 1024
int cr_service(bool deamon_mode);
int send_criu_dump_resp(int socket_fd, bool success, bool restored);
extern struct _cr_service_client *cr_se... |
Check that void function can return a value |
#include <stddef.h>
#include <stdint.h>
#include "cc1.h"
Symbol *curfun;
extern Node *convert(Node *np, Type *tp1, char iscast);
static void
Return(void)
{
Node *np;
Type *tp = curfun->type->type;
expect(RETURN);
np = expr();
if (np->type != tp) {
if ((np = convert(np, tp, 0)) == NULL)
error("incorrect ... |
#include <stddef.h>
#include <stdint.h>
#include "cc1.h"
Symbol *curfun;
extern Node *convert(Node *np, Type *tp1, char iscast);
static void
Return(void)
{
Node *np;
Type *tp = curfun->type->type;
expect(RETURN);
np = expr();
if (np->type != tp) {
if (tp == voidtype)
warn(1, "function returning void ret... |
Fix testcase when building on darwin | // RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
int \uaccess = 0;
// ALLOWED: "곎ss":
// ALLOWED-NOT: "\uaccess":
// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifi... | // RUN: %clang --target=x86_64--linux-gnu -S %s -o - | FileCheck %s -check-prefix=ALLOWED
// RUN: not %clang --target=x86_64--linux-gnu -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
int \uaccess = 0;
// ALLOWED: "곎ss":
// ALLOWED-NOT: "\uaccess":
// DENIED: warning: universal character names are only val... |
Add test case for hex floating point constants in < C99 mode - For: rdar://6096838 | /* RUN: clang -fsyntax-only -verify %s &&
* RUN: clang -std=gnu89 -fsyntax-only -verify %s &&
* RUN: clang -DPEDANTIC -pedantic -std=gnu89 -fsyntax-only -verify %s
*/
#ifdef PEDANTIC
long double d = 0x0.0000003ffffffff00000p-16357L; /* expected-warning {{ hexadecimal floating constants are a C99 feature }} */
#el... | |
UPDATE AIComp struct to initiate all variables except array | #ifndef AIDLL_AI_AICOMPONENT_H
#define AIDLL_AI_AICOMPONENT_H
#include <DirectXMath.h>
enum Pattern : int
{
AI_LINEAR = 1,
AI_CIRCULAR,
AI_ROUNTRIP,
AI_RANDOM,
AI_NONE = -1
};
__declspec(align(16)) struct AIComponent
{
// System variables
int AP_active = 0;
int AP_entityID = -1;
// AI variables
bool AP_trig... | #ifndef AIDLL_AI_AICOMPONENT_H
#define AIDLL_AI_AICOMPONENT_H
#include <DirectXMath.h>
enum Pattern : int
{
AI_LINEAR = 1,
AI_CIRCULAR,
AI_ROUNTRIP,
AI_RANDOM,
AI_NONE = -1
};
__declspec(align(16)) struct AIComponent
{
// System variables
int AP_active = 0;
int AP_entityID = -1;
// AI variables
bool AP_trig... |
Revert changes on .h file. | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* libhostile
*
* Copyright (C) 2011 Data Differential, http://datadifferential.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Softwar... | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* libhostile
*
* Copyright (C) 2011 Data Differential, http://datadifferential.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Softwar... |
Add full/half option for tree. | /*Build: gcc -std=c99 -o xmas3 xmas3.c*/
#include <stdlib.h>
#include <stdio.h>
int print_tree(int length)
{
int i = 0, j = 0;
for (i = 0;i<length;i++)
{
for (j = 0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
int main(int argc, char*argv[])
... | /*Build: gcc -std=c99 -o xmas3 xmas3.c*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void usage(char *argv0)
{
printf("USAGE: %s [height] [half|full]\n", argv0);
exit(-1);
}
int print_tree(int height, char half)
{
int i = 0, j = 0;
if (half) // Half tree
{
for (i = 0;i < he... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.