Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Remove process_may_block since it's no longer used except in xwindows.cpp.
/* Title: Basic IO. Copyright (c) 2000 David C. J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef BASICIO_H #define BASICIO_H class SaveVecEntry; typedef SaveVecEntry *Handle; class TaskData; extern Handle IO_dispatch_c(TaskData *mdTaskData, Handle args, Handle strm, Handle code); extern Handle change_dirc(TaskData *mdTaskData, Handle name); #ifndef WINDOWS_PC extern void process_may_block(TaskData *taskData, int fd, int ioCall); #endif #endif /* BASICIO_H */
/* Title: Basic IO. Copyright (c) 2000 David C. J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef BASICIO_H #define BASICIO_H class SaveVecEntry; typedef SaveVecEntry *Handle; class TaskData; extern Handle IO_dispatch_c(TaskData *mdTaskData, Handle args, Handle strm, Handle code); extern Handle change_dirc(TaskData *mdTaskData, Handle name); #endif /* BASICIO_H */
Fix for compiler error in r4154
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkStippleMaskFilter_DEFINED #define SkStippleMaskFilter_DEFINED #include "SkMaskFilter.h" /** * Simple MaskFilter that creates a screen door stipple pattern */ class SkStippleMaskFilter : public SkMaskFilter { public: SkStippleMaskFilter() : INHERITED() { } virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix& matrix, SkIPoint* margin) SK_OVERRIDE; // getFormat is from SkMaskFilter virtual SkMask::Format getFormat() SK_OVERRIDE { return SkMask::kA8_Format; } SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkStippleMaskFilter); protected: SkStippleMaskFilter::SkStippleMaskFilter(SkFlattenableReadBuffer& buffer) : SkMaskFilter(buffer) { } private: typedef SkMaskFilter INHERITED; }; #endif // SkStippleMaskFilter_DEFINED
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkStippleMaskFilter_DEFINED #define SkStippleMaskFilter_DEFINED #include "SkMaskFilter.h" /** * Simple MaskFilter that creates a screen door stipple pattern */ class SkStippleMaskFilter : public SkMaskFilter { public: SkStippleMaskFilter() : INHERITED() { } virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix& matrix, SkIPoint* margin) SK_OVERRIDE; // getFormat is from SkMaskFilter virtual SkMask::Format getFormat() SK_OVERRIDE { return SkMask::kA8_Format; } SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkStippleMaskFilter); protected: SkStippleMaskFilter(SkFlattenableReadBuffer& buffer) : SkMaskFilter(buffer) { } private: typedef SkMaskFilter INHERITED; }; #endif // SkStippleMaskFilter_DEFINED
Fix build issue for Linux
#ifndef QCMAINTHREADRUNNER_H #define QCMAINTHREADRUNNER_H #include <QObject> #include <QVariant> #include <QEVent> #include <QCoreApplication> class QCMainThreadRunner { public: /// Run a function on main thread. If it is already in main thread, it will be executed in next tick. template <typename F> static void start(F func) { QObject tmp; QObject::connect(&tmp, &QObject::destroyed, QCoreApplication::instance(), std::move(func), Qt::QueuedConnection); } /// Run a function with custom data on main thread. If it is already in main thread, it will be executed in next tick. template <typename F,typename P1> static void start(F func,P1 p1) { auto wrapper = [=]() -> void{ func(p1); }; QObject tmp; QObject::connect(&tmp, &QObject::destroyed, QCoreApplication::instance(), std::move(wrapper), Qt::QueuedConnection); } template <typename F,typename P1, typename P2> static void start(F func,P1 p1, P2 p2) { auto wrapper = [=]() -> void{ func(p1, p2); }; QObject tmp; QObject::connect(&tmp, &QObject::destroyed, QCoreApplication::instance(), std::move(wrapper), Qt::QueuedConnection); } }; #endif // QCMAINTHREADRUNNER_H
#ifndef QCMAINTHREADRUNNER_H #define QCMAINTHREADRUNNER_H #include <QObject> #include <QCoreApplication> class QCMainThreadRunner { public: /// Run a function on main thread. If it is already in main thread, it will be executed in next tick. template <typename F> static void start(F func) { QObject tmp; QObject::connect(&tmp, &QObject::destroyed, QCoreApplication::instance(), std::move(func), Qt::QueuedConnection); } /// Run a function with custom data on main thread. If it is already in main thread, it will be executed in next tick. template <typename F,typename P1> static void start(F func,P1 p1) { auto wrapper = [=]() -> void{ func(p1); }; QObject tmp; QObject::connect(&tmp, &QObject::destroyed, QCoreApplication::instance(), std::move(wrapper), Qt::QueuedConnection); } template <typename F,typename P1, typename P2> static void start(F func,P1 p1, P2 p2) { auto wrapper = [=]() -> void{ func(p1, p2); }; QObject tmp; QObject::connect(&tmp, &QObject::destroyed, QCoreApplication::instance(), std::move(wrapper), Qt::QueuedConnection); } }; #endif // QCMAINTHREADRUNNER_H
Add a missing header from one of the tests
#ifndef TEST_COLLISIONS_H #define TEST_COLLISIONS_H #include <kaztest/kaztest.h> #include "spindash/spindash.h" #include "spindash/collision/collide.h" #include "spindash/collision/ray_box.h" const SDVec2 box_points[] = { { -5, -5 }, { 5, -5 }, { 5, 0 }, { -5, 0 } }; class CollisionGeomTest : public TestCase { public: void test_ray_box_floor_sensors() { RayBox ray_box(nullptr, 0.5f, 1.0f); ray_box.set_position(0, 0.5); Box floor(nullptr, 10.0f, 1.0f); floor.set_position(0, -0.5); std::vector<Collision> collisions = collide(&ray_box, &floor); assert_equal(2, collisions.size()); assert_equal('A', collisions[0].a_ray); assert_equal('B', collisions[1].a_ray); assert_equal(0.0, collisions[0].point.y); assert_equal(0.0, collisions[1].point.y); } private: }; #endif // TEST_COLLISIONS_H
#ifndef TEST_COLLISIONS_H #define TEST_COLLISIONS_H #include <kaztest/kaztest.h> #include "spindash/spindash.h" #include "spindash/collision/collide.h" #include "spindash/collision/ray_box.h" #include "spindash/collision/box.h" const SDVec2 box_points[] = { { -5, -5 }, { 5, -5 }, { 5, 0 }, { -5, 0 } }; class CollisionGeomTest : public TestCase { public: void test_ray_box_floor_sensors() { RayBox ray_box(nullptr, 0.5f, 1.0f); ray_box.set_position(0, 0.5); Box floor(nullptr, 10.0f, 1.0f); floor.set_position(0, -0.5); std::vector<Collision> collisions = collide(&ray_box, &floor); assert_equal(2, collisions.size()); assert_equal('A', collisions[0].a_ray); assert_equal('B', collisions[1].a_ray); assert_equal(0.0, collisions[0].point.y); assert_equal(0.0, collisions[1].point.y); } private: }; #endif // TEST_COLLISIONS_H
Remove TODO. Tested common credentials, didn't work.
#pragma once #include "initiation/sipmessageprocessor.h" #include "initiation/siptypes.h" /* This class handles the authentication for this connection * should we receive a challenge */ class SIPAuthentication : public SIPMessageProcessor { Q_OBJECT public: SIPAuthentication(); public slots: // add credentials to request, if we have them virtual void processOutgoingRequest(SIPRequest& request, QVariant& content); // take challenge if they require authentication virtual void processIncomingResponse(SIPResponse& response, QVariant& content); private: DigestResponse generateAuthResponse(DigestChallenge& challenge, QString username, SIP_URI& requestURI, SIPRequestMethod method, QVariant& content); void updateNonceCount(DigestChallenge& challenge, DigestResponse& response); // TODO: Test if these need to be separate QList<DigestChallenge> wwwChallenges_; QList<DigestChallenge> proxyChallenges_; QList<DigestResponse> authorizations_; QList<DigestResponse> proxyAuthorizations_; // key is realm and value current nonce std::map<QString, QString> realmToNonce_; std::map<QString, uint32_t> realmToNonceCount_; QByteArray a1_; };
#pragma once #include "initiation/sipmessageprocessor.h" #include "initiation/siptypes.h" /* This class handles the authentication for this connection * should we receive a challenge */ class SIPAuthentication : public SIPMessageProcessor { Q_OBJECT public: SIPAuthentication(); public slots: // add credentials to request, if we have them virtual void processOutgoingRequest(SIPRequest& request, QVariant& content); // take challenge if they require authentication virtual void processIncomingResponse(SIPResponse& response, QVariant& content); private: DigestResponse generateAuthResponse(DigestChallenge& challenge, QString username, SIP_URI& requestURI, SIPRequestMethod method, QVariant& content); void updateNonceCount(DigestChallenge& challenge, DigestResponse& response); QList<DigestChallenge> wwwChallenges_; QList<DigestChallenge> proxyChallenges_; QList<DigestResponse> authorizations_; QList<DigestResponse> proxyAuthorizations_; // key is realm and value current nonce std::map<QString, QString> realmToNonce_; std::map<QString, uint32_t> realmToNonceCount_; QByteArray a1_; };
Set up GDT and load 32-Bit Segments
/* * ASXSoft Nuke - Operating System * Copyright (C) 2009 Patrick Pokatilo * * 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "stdint.h" #include "stddef.h" #include "gdt.h" extern gdt_pointer_t gdt_pointer; void start_rocket_engine() { gdt_initialize(); gdt_load(); gdt_flush_registers(0x08, 0x18, 0x18, 0x00, 0x00, 0x18); while(1); }
Add WARN annotations and explanations to test, expand it with one case.
#include <fcntl.h> #include <unistd.h> typedef void (*fnct_ptr)(void); typedef int (*open_t)(const char*,int,int); typedef int (*ftruncate_t)(int,off_t); // Goblint used to crash on this example because the number of supplied arguments for myopen is bigger than // than the expected number of arguments for the library function descriptior of ftruncate. // -- "open" expects 3 arguments, while "ftruncate" expects only 2. int main(){ fnct_ptr ptr; int top; if (top){ ptr = &open; } else { ptr = &ftruncate; } if (top) { // Some (nonsensical, but compiling) call to open open_t myopen; myopen = (open_t) ptr; myopen("some/path", O_CREAT, 0); } else { // Some (nonsensical, but compiling) call to ftruncate ftruncate_t myftruncate; myftruncate = (ftruncate_t) ptr; myftruncate(0, 100); } return 0; }
#include <fcntl.h> #include <unistd.h> typedef void (*fnct_ptr)(void); typedef int (*open_t)(const char*,int,...); typedef int (*ftruncate_t)(int,off_t); // Goblint used to crash on this example because the number of supplied arguments for myopen is bigger than // than the expected number of arguments for the library function descriptior of ftruncate. // -- "open" expects 3 arguments, while "ftruncate" expects only 2. int main(){ fnct_ptr ptr; int top, top2, top3; if (top){ ptr = (fnct_ptr) &open; ftruncate_t myftruncate; myftruncate = (ftruncate_t) ptr; myftruncate(0, 100); //NOWARN } else { ptr = (fnct_ptr) &ftruncate; } if (top2) { open_t myopen; myopen = (open_t) ptr; // Warn about possible call to ftruncate with wrong number of arguments myopen("some/path", 0, 0); // WARN } else if(top3) { ftruncate_t myftruncate2; myftruncate2 = (ftruncate_t) ptr; off_t v = 100; // We (currently) only warn about wrong number of args, not wrong type // So no warning is emitted here about possibly calling the vararg function open. myftruncate2(0, v); } else { // Warn about potential calls to open and ftruncate with too few arguments, // and warn that none of the possible targets of the pointer fit as call targets. ptr(); // WARN } return 0; }
Add divider constructor with interval default argument
#ifndef CONSOLE_H #define CONSOLE_H #include <Cart.h> #include <Controller.h> #include <CPU.h> #include <PPU.h> #include <APU.h> class Divider { public: void setInterval(int interval) { this->interval = interval; clockCounter = interval - 1; } void tick() { clockCounter++; if (clockCounter == interval) { clockCounter = 0; } } bool hasClocked() { return clockCounter == 0; } private: int interval; int clockCounter; }; class Console { public: ~Console(); void boot(); void runForOneFrame(); uint32_t *getFrameBuffer(); Cart cart; Controller controller1; private: void tick(); CPU *cpu; PPU *ppu; APU apu; Divider cpuDivider; }; #endif
#ifndef CONSOLE_H #define CONSOLE_H #include <Cart.h> #include <Controller.h> #include <CPU.h> #include <PPU.h> #include <APU.h> class Divider { public: Divider(int interval = 1) { setInterval(interval); } void setInterval(int interval) { this->interval = interval; clockCounter = interval - 1; } void tick() { clockCounter++; if (clockCounter == interval) { clockCounter = 0; } } bool hasClocked() { return clockCounter == 0; } private: int interval; int clockCounter; }; class Console { public: ~Console(); void boot(); void runForOneFrame(); uint32_t *getFrameBuffer(); Cart cart; Controller controller1; private: void tick(); CPU *cpu; PPU *ppu; APU apu; Divider cpuDivider; }; #endif
Fix implicit declaration of function ‘time’
/** * @file utils.h * @brief Storj utilities. * * Helper utilities */ #ifndef STORJ_UTILS_H #define STORJ_UTILS_H #include <assert.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #ifdef _WIN32 #include <windows.h> #else #include <sys/time.h> #endif int hex2str(unsigned length, uint8_t *data, char *buffer); void print_int_array(uint8_t *array, unsigned length); int str2hex(unsigned length, char *data, uint8_t *buffer); void random_buffer(uint8_t *buf, size_t len); uint64_t shard_size(int hops); uint64_t get_time_milliseconds(); void memset_zero(void *v, size_t n); #endif /* STORJ_UTILS_H */
/** * @file utils.h * @brief Storj utilities. * * Helper utilities */ #ifndef STORJ_UTILS_H #define STORJ_UTILS_H #include <assert.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #ifdef _WIN32 #include <windows.h> #include <time.h> #else #include <sys/time.h> #endif int hex2str(unsigned length, uint8_t *data, char *buffer); void print_int_array(uint8_t *array, unsigned length); int str2hex(unsigned length, char *data, uint8_t *buffer); void random_buffer(uint8_t *buf, size_t len); uint64_t shard_size(int hops); uint64_t get_time_milliseconds(); void memset_zero(void *v, size_t n); #endif /* STORJ_UTILS_H */
Make conversions between integer sizes explicit
#pragma once #include "definitions.h" #include "util/log.h" inline u16 compose_bytes(const u8 high, const u8 low) { return (high << 8) + low; } inline bool check_bit(const u8 value, const int bit) { return (value & (1 << bit)) != 0; } inline u8 set_bit(const u8 value, const int bit) { return value | (1 << bit); } inline u8 clear_bit(const u8 value, const int bit) { return value & ~(1 << bit); } inline u8 set_bit_to(const u8 value, const int bit, bool bit_on) { if (bit_on) { return set_bit(value, bit); } else { return clear_bit(value, bit); } }
#pragma once #include "definitions.h" #include "util/log.h" inline u16 compose_bytes(const u8 high, const u8 low) { return static_cast<u16>((high << 8) + low); } inline bool check_bit(const u8 value, const u8 bit) { return (value & (1 << bit)) != 0; } inline u8 set_bit(const u8 value, const u8 bit) { auto value_set = value | (1 << bit); return static_cast<u8>(value_set); } inline u8 clear_bit(const u8 value, const u8 bit) { auto value_cleared = value & ~(1 << bit); return static_cast<u8>(value_cleared); } inline u8 set_bit_to(const u8 value, const u8 bit, bool bit_on) { if (bit_on) { return set_bit(value, bit); } else { return clear_bit(value, bit); } }
Fix this test case for CMake builds after r126502, which sneakily changed the actual executable name to clang-<version>.
// RUN: %clang -ccc-echo -o %t %s 2> %t.log // Make sure we used clang. // RUN: grep 'clang" -cc1 .*hello.c' %t.log // RUN: %t > %t.out // RUN: grep "I'm a little driver, short and stout." %t.out // FIXME: We don't have a usable assembler on Windows, so we can't build real // apps yet. // XFAIL: win32 #include <stdio.h> int main() { printf("I'm a little driver, short and stout."); return 0; }
// RUN: %clang -ccc-echo -o %t %s 2> %t.log // Make sure we used clang. // RUN: grep 'clang\(-[0-9.]\+\)\?" -cc1 .*hello.c' %t.log // RUN: %t > %t.out // RUN: grep "I'm a little driver, short and stout." %t.out // FIXME: We don't have a usable assembler on Windows, so we can't build real // apps yet. // XFAIL: win32 #include <stdio.h> int main() { printf("I'm a little driver, short and stout."); return 0; }
Remove types left over from header split
#ifndef KISS_TEMPLATES_KISTE_H #define KISS_TEMPLATES_KISTE_H #include <kiste/terminal.h> #include <kiste/raw.h> namespace kiste { struct terminal_t { }; constexpr auto terminal = terminal_t{}; struct raw { std::ostream& _os; template <typename T> auto operator()(T&& t) const -> void { _os << std::forward<T>(t); } }; } #endif
#ifndef KISS_TEMPLATES_KISTE_H #define KISS_TEMPLATES_KISTE_H #include <kiste/terminal.h> #include <kiste/raw.h> #endif
Revert 88957. This file uses CodeGenOpt, which is defined in TargetMachine.h.
//===-- MachineFunctionAnalysis.h - Owner of MachineFunctions ----*-C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file declares the MachineFunctionAnalysis class. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINE_FUNCTION_ANALYSIS_H #define LLVM_CODEGEN_MACHINE_FUNCTION_ANALYSIS_H #include "llvm/Pass.h" namespace llvm { class MachineFunction; class TargetMachine; /// MachineFunctionAnalysis - This class is a Pass that manages a /// MachineFunction object. struct MachineFunctionAnalysis : public FunctionPass { private: const TargetMachine &TM; CodeGenOpt::Level OptLevel; MachineFunction *MF; public: static char ID; explicit MachineFunctionAnalysis(const TargetMachine &tm, CodeGenOpt::Level OL = CodeGenOpt::Default); ~MachineFunctionAnalysis(); MachineFunction &getMF() const { return *MF; } CodeGenOpt::Level getOptLevel() const { return OptLevel; } private: virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; }; } // End llvm namespace #endif
//===-- MachineFunctionAnalysis.h - Owner of MachineFunctions ----*-C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file declares the MachineFunctionAnalysis class. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINE_FUNCTION_ANALYSIS_H #define LLVM_CODEGEN_MACHINE_FUNCTION_ANALYSIS_H #include "llvm/Pass.h" #include "llvm/Target/TargetMachine.h" namespace llvm { class MachineFunction; /// MachineFunctionAnalysis - This class is a Pass that manages a /// MachineFunction object. struct MachineFunctionAnalysis : public FunctionPass { private: const TargetMachine &TM; CodeGenOpt::Level OptLevel; MachineFunction *MF; public: static char ID; explicit MachineFunctionAnalysis(const TargetMachine &tm, CodeGenOpt::Level OL = CodeGenOpt::Default); ~MachineFunctionAnalysis(); MachineFunction &getMF() const { return *MF; } CodeGenOpt::Level getOptLevel() const { return OptLevel; } private: virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; }; } // End llvm namespace #endif
Update driver version to 5.04.00-k1
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.04.00-k0"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.04.00-k1"
Remove extraneous method in Problem 15
//===-- problems/Problem15.h ------------------------------------*- C++ -*-===// // // ProjectEuler.net solutions by Will Mitchell // // This file is distributed under the MIT License. See LICENSE for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Problem 15: Lattice paths /// //===----------------------------------------------------------------------===// #ifndef PROBLEMS_PROBLEM15_H #define PROBLEMS_PROBLEM15_H #include <string> #include <gmpxx.h> #include "../Problem.h" namespace problems { class Problem15 : public Problem { public: Problem15() : value(0), solved(false) {} ~Problem15() = default; std::string answer(); std::string description() const; void solve(); // Simple brute force solution unsigned long long bruteForce(const unsigned long long limit) const; private: /// Cached answer mpz_class value; /// If cached answer is valid bool solved; }; } #endif
//===-- problems/Problem15.h ------------------------------------*- C++ -*-===// // // ProjectEuler.net solutions by Will Mitchell // // This file is distributed under the MIT License. See LICENSE for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Problem 15: Lattice paths /// //===----------------------------------------------------------------------===// #ifndef PROBLEMS_PROBLEM15_H #define PROBLEMS_PROBLEM15_H #include <string> #include <gmpxx.h> #include "../Problem.h" namespace problems { class Problem15 : public Problem { public: Problem15() : value(0), solved(false) {} ~Problem15() = default; std::string answer(); std::string description() const; void solve(); private: /// Cached answer mpz_class value; /// If cached answer is valid bool solved; }; } #endif
Add name method to custom tools
#ifndef QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #define QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #include "abstractformeditortool.h" namespace QmlDesigner { class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool { public: AbstractCustomTool(); void selectedItemsChanged(const QList<FormEditorItem *> &itemList) QTC_OVERRIDE; virtual int wantHandleItem(const ModelNode &modelNode) const QTC_OVERRIDE = 0; }; } // namespace QmlDesigner #endif // QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H
#ifndef QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #define QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #include "abstractformeditortool.h" namespace QmlDesigner { class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool { public: AbstractCustomTool(); void selectedItemsChanged(const QList<FormEditorItem *> &itemList) QTC_OVERRIDE; virtual QString name() const = 0; virtual int wantHandleItem(const ModelNode &modelNode) const QTC_OVERRIDE = 0; }; } // namespace QmlDesigner #endif // QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H
Fix to compile on VS2008.
//===-- llvm/CodeGen/Spiller.h - Spiller -*- C++ -*------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_SPILLER_H #define LLVM_CODEGEN_SPILLER_H #include <vector> namespace llvm { /// Spiller interface. /// /// Implementations are utility classes which insert spill or remat code on /// demand. class Spiller { public: virtual ~Spiller() = 0; virtual std::vector<class LiveInterval*> spill(class LiveInterval *li) = 0; }; /// Create and return a spiller object, as specified on the command line. Spiller* createSpiller(class MachineFunction *mf, class LiveIntervals *li, class VirtRegMap *vrm); } #endif
//===-- llvm/CodeGen/Spiller.h - Spiller -*- C++ -*------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_SPILLER_H #define LLVM_CODEGEN_SPILLER_H #include <vector> namespace llvm { struct LiveInterval; /// Spiller interface. /// /// Implementations are utility classes which insert spill or remat code on /// demand. class Spiller { public: virtual ~Spiller() = 0; virtual std::vector<LiveInterval*> spill(class LiveInterval *li) = 0; }; /// Create and return a spiller object, as specified on the command line. Spiller* createSpiller(class MachineFunction *mf, class LiveIntervals *li, class VirtRegMap *vrm); } #endif
Add a (public) header to set cpu endianness when numpy headers are included instead of setting them at build time.
#ifndef _NPY_ENDIAN_H_ #define _NPY_ENDIAN_H_ /* NPY_BYTE_ORDER is set to the same value as BYTE_ORDER set by glibc in * endian.h */ #ifdef NPY_HAVE_ENDIAN_H /* Use endian.h if available */ #include <endian.h> #define NPY_BYTE_ODER __BYTE_ORDER #if (__BYTE_ORDER == __LITTLE_ENDIAN) #define NPY_LITTLE_ENDIAN #elif (__BYTE_ORDER == __BIG_ENDIAN) #define NPY_BYTE_ODER __BYTE_ORDER #else #error Unknown machine endianness detected. #endif #else /* Set endianness info using target CPU */ #include "cpuarch.h" #if defined(NPY_X86) || defined(NPY_AMD64) #define NPY_LITTLE_ENDIAN #define NPY_BYTE_ORDER 1234 #elif defined(NPY_PPC) || defined(NPY_SPARC) || defined(NPY_S390) || \ defined(NPY_PA_RISC) #define NPY_BIG_ENDIAN #define NPY_BYTE_ORDER 4321 #endif #endif #endif
Remove SK_LEGACY_HEIF_API to enable animation in SkHeifCodec
/* * 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 (768 * 1024) #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024) #define SK_USE_FREETYPE_EMBOLDEN // Disable these Ganesh features #define SK_DISABLE_REDUCE_OPLIST_SPLITTING // Check error is expensive. HWUI historically also doesn't check its allocations #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0 // Legacy flags #define SK_IGNORE_GPU_DITHER #define SK_SUPPORT_DEPRECATED_CLIPOPS // Needed until we fix https://bug.skia.org/2440 #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER #define SK_SUPPORT_LEGACY_AA_CHOICE #define SK_SUPPORT_LEGACY_AAA_CHOICE #define SK_DISABLE_DAA // skbug.com/6886 #define SK_LEGACY_HEIF_API #endif // SkUserConfigManual_DEFINED
/* * 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 (768 * 1024) #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024) #define SK_USE_FREETYPE_EMBOLDEN // Disable these Ganesh features #define SK_DISABLE_REDUCE_OPLIST_SPLITTING // Check error is expensive. HWUI historically also doesn't check its allocations #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0 // Legacy flags #define SK_IGNORE_GPU_DITHER #define SK_SUPPORT_DEPRECATED_CLIPOPS // Needed until we fix https://bug.skia.org/2440 #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER #define SK_SUPPORT_LEGACY_AA_CHOICE #define SK_SUPPORT_LEGACY_AAA_CHOICE #define SK_DISABLE_DAA // skbug.com/6886 #endif // SkUserConfigManual_DEFINED
Stop SkyShell from crashing on startup
// Copyright 2015 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 SKY_SHELL_PLATFORM_VIEW_ANDROID_H_ #define SKY_SHELL_PLATFORM_VIEW_ANDROID_H_ #include "sky/shell/platform_view.h" struct ANativeWindow; namespace sky { namespace shell { class PlatformViewAndroid : public PlatformView { public: static bool Register(JNIEnv* env); ~PlatformViewAndroid() override; // Called from Java void Detach(JNIEnv* env, jobject obj); void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); void SurfaceDestroyed(JNIEnv* env, jobject obj); private: void ReleaseWindow(); ANativeWindow* window_; DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroid); }; } // namespace shell } // namespace sky #endif // SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
// Copyright 2015 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 SKY_SHELL_PLATFORM_VIEW_ANDROID_H_ #define SKY_SHELL_PLATFORM_VIEW_ANDROID_H_ #include "sky/shell/platform_view.h" struct ANativeWindow; namespace sky { namespace shell { class PlatformViewAndroid : public PlatformView { public: static bool Register(JNIEnv* env); ~PlatformViewAndroid() override; // Called from Java void Detach(JNIEnv* env, jobject obj); void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); void SurfaceDestroyed(JNIEnv* env, jobject obj); private: void ReleaseWindow(); DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroid); }; } // namespace shell } // namespace sky #endif // SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
Add the vpsc library for IPSEPCOLA features
/** * \brief Solve an instance of the "Variable Placement with Separation * Constraints" problem. * * Authors: * Tim Dwyer <tgdwyer@gmail.com> * * Copyright (C) 2005 Authors * * This version is released under the CPL (Common Public License) with * the Graphviz distribution. * A version is also available under the LGPL as part of the Adaptagrams * project: http://sourceforge.net/projects/adaptagrams. * If you make improvements or bug fixes to this code it would be much * appreciated if you could also contribute those changes back to the * Adaptagrams repository. */ #ifndef SEEN_REMOVEOVERLAP_SOLVE_VPSC_H #define SEEN_REMOVEOVERLAP_SOLVE_VPSC_H #include <vector> class Variable; class Constraint; class Blocks; /** * Variable Placement with Separation Constraints problem instance */ class VPSC { public: virtual void satisfy(); virtual void solve(); VPSC(const unsigned n, Variable *vs[], const unsigned m, Constraint *cs[]); virtual ~VPSC(); protected: Blocks *bs; Constraint **cs; unsigned m; void printBlocks(); private: void refine(); bool constraintGraphIsCyclic(const unsigned n, Variable *vs[]); bool blockGraphIsCyclic(); }; class IncVPSC : VPSC { public: unsigned splitCnt; void satisfy(); void solve(); void moveBlocks(); void splitBlocks(); IncVPSC(const unsigned n, Variable *vs[], const unsigned m, Constraint *cs[]); private: typedef std::vector<Constraint*> ConstraintList; ConstraintList inactive; double mostViolated(ConstraintList &l,Constraint* &v); }; #endif // SEEN_REMOVEOVERLAP_SOLVE_VPSC_H
Add a missing include guard
#include "ruby.h" #include <osl/move.h> extern VALUE cMove; using namespace osl; void rb_move_free(Move* ptr); static VALUE rb_move_s_new(VALUE self); void Init_move(void);
#ifndef RBOSL_MOVE_H #define RBOSL_MOVE_H #include "ruby.h" #include <osl/move.h> extern VALUE cMove; using namespace osl; void rb_move_free(Move* ptr); static VALUE rb_move_s_new(VALUE self); void Init_move(void); #endif /* RBOSL_MOVE_H */
Add OSF/1 to a pre-existing conditional compilation switch.
#ifndef FIX_UNISTD_H #define FIX_UNISTD_H #include <unistd.h> /* For some reason the g++ include files on Ultrix 4.3 fail to provide these prototypes, even though the Ultrix 4.2 versions did... */ #if defined(ULTRIX43) #if defined(__cplusplus) extern "C" { #endif #if defined(__STDC__) || defined(__cplusplus) int symlink( const char *, const char * ); char *sbrk( int ); int gethostname( char *, int ); #else int symlink(); char *sbrk(); int gethostname(); #endif #if defined(__cplusplus) } #endif #endif /* ULTRIX43 */ #endif
#ifndef FIX_UNISTD_H #define FIX_UNISTD_H #include <unistd.h> /* For some reason the g++ include files on Ultrix 4.3 fail to provide these prototypes, even though the Ultrix 4.2 versions did... Once again, OSF1 also chokes, unless _AES_SOURCE(?) is defined JCP */ #if defined(ULTRIX43) || defined(OSF1) #if defined(__cplusplus) extern "C" { #endif #if defined(__STDC__) || defined(__cplusplus) int symlink( const char *, const char * ); char *sbrk( int ); int gethostname( char *, int ); #else int symlink(); char *sbrk(); int gethostname(); #endif #if defined(__cplusplus) } #endif #endif /* ULTRIX43 */ #endif
Add constant test for congruence domain
// PARAM: --enable ana.int.congruence --disable ana.int.def_exc // This test ensures that operations on constant congr. classes (i.e. classes of the form {k} : arbitrary integer k) yield concrete vals int main() { // basic arithmetic operators int a = 1; int b = 2; int c = -1; int d = -2; assert (a + b == 3); assert (a + d == -1); assert (a * b == 2); assert (b * c == -2); assert (a / b == 0); assert (d / c == 2); assert (b % a == 0); assert (d % c == 0); assert (-a == -1); assert (-d == 2); // logical operators int zero = 0; int one = 1; unsigned int uns_z = 0; assert ((zero || one) == 1); assert ((zero || zero) == 0); assert ((one || one) == 1); assert ((zero && one) == 0); assert ((zero && zero) == 0); assert ((one && one) == 1); assert (!one == 0); assert (!zero == 1); // bitwise operators assert ((zero & zero) == 0); assert ((zero & one) == 0); assert ((one & zero) == 0); assert ((one & one) == 1); assert ((zero | zero) == 0); assert ((zero | one) == 1); assert ((one | zero) == 1); assert ((one | one) == 1); assert ((zero ^ zero) == 0); assert ((zero ^ one) == 1); assert ((one ^ zero) == 1); assert ((one ^ one) == 0); assert (~zero == -1); assert (~uns_z == 4294967295); // shift-left unsigned char m = 136; assert ((m << 1) == 16); //shift-right missing as only top() is returned currently // comparisons assert ((a < b) == 1); assert ((a > b) == 0); assert ((a == b) == 0); assert ((a != b) == 1); return 0; }
Use numeric_limits<double>::lowest instead of numeric_limits<double>::min
// Copyright (c) 2020 The Orbit Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ORBIT_GL_GRAPH_TRACK_H #define ORBIT_GL_GRAPH_TRACK_H #include <limits> #include "ScopeTimer.h" #include "Track.h" class TimeGraph; class GraphTrack : public Track { public: explicit GraphTrack(TimeGraph* time_graph); Type GetType() const override { return kGraphTrack; } void Draw(GlCanvas* canvas, bool picking) override; void OnDrag(int x, int y) override; void AddTimer(const Timer& timer) override; float GetHeight() const override; protected: std::map<uint64_t, double> values_; double min_ = std::numeric_limits<double>::max(); double max_ = std::numeric_limits<double>::min(); double value_range_ = 0; double inv_value_range_ = 0; }; #endif
// Copyright (c) 2020 The Orbit Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ORBIT_GL_GRAPH_TRACK_H #define ORBIT_GL_GRAPH_TRACK_H #include <limits> #include "ScopeTimer.h" #include "Track.h" class TimeGraph; class GraphTrack : public Track { public: explicit GraphTrack(TimeGraph* time_graph); Type GetType() const override { return kGraphTrack; } void Draw(GlCanvas* canvas, bool picking) override; void OnDrag(int x, int y) override; void AddTimer(const Timer& timer) override; float GetHeight() const override; protected: std::map<uint64_t, double> values_; double min_ = std::numeric_limits<double>::max(); double max_ = std::numeric_limits<double>::lowest(); double value_range_ = 0; double inv_value_range_ = 0; }; #endif
Update QT Py flash size
#define MICROPY_HW_BOARD_NAME "Adafruit QTPy RP2040" #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_NEOPIXEL (&pin_GPIO12) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO25) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO24) #define DEFAULT_SPI_BUS_SCK (&pin_GPIO6) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO3) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) // #define DEFAULT_UART_BUS_RX (&pin_PA11) // #define DEFAULT_UART_BUS_TX (&pin_PA10) // Flash chip is GD25Q32 connected over QSPI #define TOTAL_FLASH_SIZE (4 * 1024 * 1024)
#define MICROPY_HW_BOARD_NAME "Adafruit QTPy RP2040" #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_NEOPIXEL (&pin_GPIO12) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO25) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO24) #define DEFAULT_SPI_BUS_SCK (&pin_GPIO6) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO3) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) // #define DEFAULT_UART_BUS_RX (&pin_PA11) // #define DEFAULT_UART_BUS_TX (&pin_PA10) // Flash chip is GD25Q64 connected over QSPI #define TOTAL_FLASH_SIZE (8 * 1024 * 1024)
Fix imgui include path in GLES renderer
// ImGui SDL2 binding with OpenGL ES 2 // You can copy and use unmodified imgui_impl_* files in your project. // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and // ImGui_ImplXXXX_Shutdown(). // See main.cpp for an example of using this. // https://github.com/ocornut/imgui #ifndef IMGUI_IMPL_SDL_GL2 #define IMGUI_IMPL_SDL_GL2 #include "../../../../../../../imgui.h" struct SDL_Window; typedef union SDL_Event SDL_Event; IMGUI_API bool ImGui_ImplSdlGLES2_Init(SDL_Window *window); IMGUI_API void ImGui_ImplSdlGLES2_Shutdown(); IMGUI_API void ImGui_ImplSdlGLES2_NewFrame(); IMGUI_API bool ImGui_ImplSdlGLES2_ProcessEvent(SDL_Event *event); // Use if you want to reset your rendering device without losing ImGui state. IMGUI_API void ImGui_ImplSdlGLES2_InvalidateDeviceObjects(); IMGUI_API bool ImGui_ImplSdlGLES2_CreateDeviceObjects(); #endif // IMGUI_IMPL_SDL_GL2
// ImGui SDL2 binding with OpenGL ES 2 // You can copy and use unmodified imgui_impl_* files in your project. // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and // ImGui_ImplXXXX_Shutdown(). // See main.cpp for an example of using this. // https://github.com/ocornut/imgui #ifndef IMGUI_IMPL_SDL_GL2 #define IMGUI_IMPL_SDL_GL2 #include "imgui/imgui.h" struct SDL_Window; typedef union SDL_Event SDL_Event; IMGUI_API bool ImGui_ImplSdlGLES2_Init(SDL_Window *window); IMGUI_API void ImGui_ImplSdlGLES2_Shutdown(); IMGUI_API void ImGui_ImplSdlGLES2_NewFrame(); IMGUI_API bool ImGui_ImplSdlGLES2_ProcessEvent(SDL_Event *event); // Use if you want to reset your rendering device without losing ImGui state. IMGUI_API void ImGui_ImplSdlGLES2_InvalidateDeviceObjects(); IMGUI_API bool ImGui_ImplSdlGLES2_CreateDeviceObjects(); #endif // IMGUI_IMPL_SDL_GL2
Remove an invalid copyright notice
// Copyright © 2015 Outware Mobile. All rights reserved. #import <Foundation/Foundation.h> FOUNDATION_EXPORT double RegexVersionNumber; FOUNDATION_EXPORT const unsigned char RegexVersionString[];
#import <Foundation/Foundation.h> FOUNDATION_EXPORT double RegexVersionNumber; FOUNDATION_EXPORT const unsigned char RegexVersionString[];
Update Resource with latest changes to FPLBase.
// Copyright 2015 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef PINDROP_ASYNCHRONOUS_LOADER_FILE_LOADER_H_ #define PINDROP_ASYNCHRONOUS_LOADER_FILE_LOADER_H_ #include "fplbase/async_loader.h" namespace pindrop { class FileLoader; class Resource : public fplbase::AsyncAsset { public: virtual ~Resource() {} void LoadFile(const char* filename, FileLoader* loader); private: virtual void Finalize() {}; }; class FileLoader { public: void StartLoading(); bool TryFinalize(); void QueueJob(Resource* resource); private: fplbase::AsyncLoader loader; }; } // namespace pindrop #endif // PINDROP_ASYNCHRONOUS_LOADER_FILE_LOADER_H_
// Copyright 2015 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef PINDROP_ASYNCHRONOUS_LOADER_FILE_LOADER_H_ #define PINDROP_ASYNCHRONOUS_LOADER_FILE_LOADER_H_ #include "fplbase/async_loader.h" namespace pindrop { class FileLoader; class Resource : public fplbase::AsyncAsset { public: virtual ~Resource() {} void LoadFile(const char* filename, FileLoader* loader); private: virtual bool Finalize() { return true; }; virtual bool IsValid() { return true; }; }; class FileLoader { public: void StartLoading(); bool TryFinalize(); void QueueJob(Resource* resource); private: fplbase::AsyncLoader loader; }; } // namespace pindrop #endif // PINDROP_ASYNCHRONOUS_LOADER_FILE_LOADER_H_
Fix test added in r321992 failing on some buildbots.
// RUN: %clang_cc1 -triple x86_64-unknown %s -S -o - | FileCheck %s --check-prefix=CHECK-ABSENT // CHECK-ABSENT-NOT: section .stack_sizes // RUN: %clang_cc1 -triple x86_64-unknown -fstack-size-section %s -S -o - | FileCheck %s --check-prefix=CHECK-PRESENT // CHECK-PRESENT: section .stack_sizes int foo() { return 42; }
// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -S -o - | FileCheck %s --check-prefix=CHECK-ABSENT // CHECK-ABSENT-NOT: section .stack_sizes // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fstack-size-section %s -S -o - | FileCheck %s --check-prefix=CHECK-PRESENT // CHECK-PRESENT: section .stack_sizes int foo() { return 42; }
Add IWYU tags to headers TF is re-exporting.
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ // StringPiece is a simple structure containing a pointer into some external // storage and a size. The user of a StringPiece must ensure that the slice // is not used after the corresponding external storage has been // deallocated. // // Multiple threads can invoke const methods on a StringPiece without // external synchronization, but if any of the threads may call a // non-const method, all threads accessing the same StringPiece must use // external synchronization. #ifndef TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_ #define TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_ #include "absl/strings/string_view.h" namespace tensorflow { using StringPiece = absl::string_view; } // namespace tensorflow #endif // TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ // StringPiece is a simple structure containing a pointer into some external // storage and a size. The user of a StringPiece must ensure that the slice // is not used after the corresponding external storage has been // deallocated. // // Multiple threads can invoke const methods on a StringPiece without // external synchronization, but if any of the threads may call a // non-const method, all threads accessing the same StringPiece must use // external synchronization. #ifndef TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_ #define TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_ #include "absl/strings/string_view.h" // IWYU pragma: export namespace tensorflow { using StringPiece = absl::string_view; } // namespace tensorflow #endif // TENSORFLOW_CORE_PLATFORM_STRINGPIECE_H_
Reimplement no-op version of DLOG to avoid C++ compiler warning
#pragma once #include <iostream> // The same as assert, but expression is always evaluated and result returned #define CHECK(expr) (assert(expr), expr) #if !defined(NDEBUG) // Debug namespace dev { namespace evmjit { std::ostream& getLogStream(char const* _channel); } } #define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL) #else // Release #define DLOG(CHANNEL) true ? std::cerr : std::cerr #endif
#pragma once #include <iostream> // The same as assert, but expression is always evaluated and result returned #define CHECK(expr) (assert(expr), expr) #if !defined(NDEBUG) // Debug namespace dev { namespace evmjit { std::ostream& getLogStream(char const* _channel); } } #define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL) #else // Release namespace dev { namespace evmjit { struct Voider { void operator=(std::ostream const&) {} }; } } #define DLOG(CHANNEL) true ? (void)0 : ::dev::evmjit::Voider{} = std::cerr #endif
Bring other get_pointer instances into the scope
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_PYTHON_HELPERS_PYTHON_WRAP_CONST_SHARED_PTR_H #define VISTK_PYTHON_HELPERS_PYTHON_WRAP_CONST_SHARED_PTR_H #include <boost/python/pointee.hpp> #include <boost/shared_ptr.hpp> // Retrieved from http://mail.python.org/pipermail/cplusplus-sig/2006-November/011329.html namespace boost { namespace python { template <typename T> inline T* get_pointer(boost::shared_ptr<T const> const& p) { return const_cast<T*>(p.get()); } template <typename T> struct pointee<boost::shared_ptr<T const> > { typedef T type; }; } } #endif // VISTK_PYTHON_HELPERS_PYTHON_WRAP_CONST_SHARED_PTR_H
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_PYTHON_HELPERS_PYTHON_WRAP_CONST_SHARED_PTR_H #define VISTK_PYTHON_HELPERS_PYTHON_WRAP_CONST_SHARED_PTR_H #include <boost/python/pointee.hpp> #include <boost/get_pointer.hpp> #include <boost/shared_ptr.hpp> // Retrieved from http://mail.python.org/pipermail/cplusplus-sig/2006-November/011329.html namespace boost { namespace python { template <typename T> inline T* get_pointer(boost::shared_ptr<T const> const& p) { return const_cast<T*>(p.get()); } template <typename T> struct pointee<boost::shared_ptr<T const> > { typedef T type; }; // Don't hide other get_pointer instances. using boost::python::get_pointer; using boost::get_pointer; } } #endif // VISTK_PYTHON_HELPERS_PYTHON_WRAP_CONST_SHARED_PTR_H
Fix missing string in namespace std compiler error
#ifndef WINDOW_H #define WINDOW_H #include <ncurses.h> #include <array> #include "../game.h" // Used to define a datatype for calls to wborder struct Border { chtype ls, rs, ts, bs; chtype tl, tr, bl, br; }; class Window { public: Window(rect dim); // ctor ~Window(); // dtor void bindWin(WINDOW *newW); int getChar(); void refresh(); void update(); void clear(); void close(); void cursorPos(vec2ui pos); void draw(vec2ui pos, char ch, chtype colo); void draw(vec2ui pos, char ch, chtype colo, int attr); void drawBorder(); void drawBox(); void write(std::string str); void write(vec2ui pos, std::string str); void coloSplash(chtype colo); rect getDim() { return dim; } void setBorder(Border b); protected: WINDOW *w; rect dim; Border border { 0,0,0,0,0,0,0,0 }; // Init to default }; #endif
#ifndef WINDOW_H #define WINDOW_H #include <ncurses.h> #include <string> #include <array> #include "../game.h" // Used to define a datatype for calls to wborder struct Border { chtype ls, rs, ts, bs; chtype tl, tr, bl, br; }; class Window { public: Window(rect dim); // ctor ~Window(); // dtor void bindWin(WINDOW *newW); int getChar(); void refresh(); void update(); void clear(); void close(); void cursorPos(vec2ui pos); void draw(vec2ui pos, char ch, chtype colo); void draw(vec2ui pos, char ch, chtype colo, int attr); void drawBorder(); void drawBox(); void write(std::string str); void write(vec2ui pos, std::string str); void coloSplash(chtype colo); rect getDim() { return dim; } void setBorder(Border b); protected: WINDOW *w; rect dim; Border border { 0,0,0,0,0,0,0,0 }; // Init to default }; #endif
Add test that by default signed overflow results in top
#include<stdio.h> #include<assert.h> int main() { int i,k,j; if (k == 5) { assert(k == 5); return 0; } assert(k != 5); // Signed overflows might occur in some of the following operations (e.g. the first assignment k could be MAX_INT). // Signed overflows are undefined behavior, so by default we go to top when they might occur. // simple arithmetic i = k + 1; assert(i != 6); // UNKNOWN! i = k - 1; assert(i != 4); // UNKNOWN! i = k * 3; assert(i != 15); // UNKNOWN! i = k * 2; assert(i != 10); // UNKNOWN! k could be -2147483643; i = k / 2; assert(i != 2); // UNKNOWN! k could be 4 return 0; }
Declare the class TPython instead of the static functions. With this change, make map will add TPython in system.rootmap and it is possible to do directly root > TPython::Prompt()
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ function TPython::Exec; #pragma link C++ function TPython::Eval; #pragma link C++ function TPython::Bind; #pragma link C++ function TPython::Prompt; #endif
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class TPython; #endif
Add spinlock model for DEC C compiler
/* * Copyright (C) 2016 Alexander Saprykin <xelfium@gmail.com> * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "pmem.h" #include "pspinlock.h" #ifdef P_OS_VMS # include <builtins.h> #else # include <machine/builtins.h> #endif struct PSpinLock_ { volatile pint spin; }; P_LIB_API PSpinLock * p_spinlock_new (void) { PSpinLock *ret; if (P_UNLIKELY ((ret = p_malloc0 (sizeof (PSpinLock))) == NULL)) { P_ERROR ("PSpinLock::p_spinlock_new: failed to allocate memory"); return NULL; } return ret; } P_LIB_API pboolean p_spinlock_lock (PSpinLock *spinlock) { if (P_UNLIKELY (spinlock == NULL)) return FALSE; (void) __LOCK_LONG ((volatile void *) &(spinlock->spin)); return TRUE; } P_LIB_API pboolean p_spinlock_trylock (PSpinLock *spinlock) { if (P_UNLIKELY (spinlock == NULL)) return FALSE; return __LOCK_LONG_RETRY ((volatile void *) &(spinlock->spin), 1) == 1 ? TRUE : FALSE; } P_LIB_API pboolean p_spinlock_unlock (PSpinLock *spinlock) { if (P_UNLIKELY (spinlock == NULL)) return FALSE; (void) __UNLOCK_LONG ((volatile void *) &(spinlock->spin)); return TRUE; } P_LIB_API void p_spinlock_free (PSpinLock *spinlock) { p_free (spinlock); }
Fix missing parenthesis in abs()
#ifndef __STDLIB_H__ #define __STDLIB_H__ #include <types.h> #define abs(ival) (ival < 0? -ival : ival) void *malloc(size_t size); void free(void *addr); struct task; void __free(void *addr, struct task *task); void *memcpy(void *dst, const void *src, size_t len); void *memset(void *src, int c, size_t len); #endif /* __STDLIB_H__ */
#ifndef __STDLIB_H__ #define __STDLIB_H__ #include <types.h> #define abs(ival) ((ival) < 0? -(ival) : (ival)) void *malloc(size_t size); void free(void *addr); struct task; void __free(void *addr, struct task *task); void *memcpy(void *dst, const void *src, size_t len); void *memset(void *src, int c, size_t len); #endif /* __STDLIB_H__ */
Fix an error on linux
#ifndef LOG_H #define LOG_H enum log_level { LOG_LEVEL_DEBUG = 10, LOG_LEVEL_MSG = 20, LOG_LEVEL_WARN = 30, LOG_LEVEL_ERR = 40 }; void set_log_level(enum log_level threshold); void log_debug(const char *fmt, ...); void log_msg(const char *fmt, ...); void log_warn(const char *fmt, ...); void log_err(const char *fmt, ...); void vplog(const int level, const char *fmt, va_list args); void plog(const int level, const char *fmt, ...); #endif
#ifndef LOG_H #define LOG_H #include <stdarg.h> enum log_level { LOG_LEVEL_DEBUG = 10, LOG_LEVEL_MSG = 20, LOG_LEVEL_WARN = 30, LOG_LEVEL_ERR = 40 }; void set_log_level(enum log_level threshold); void log_debug(const char *fmt, ...); void log_msg(const char *fmt, ...); void log_warn(const char *fmt, ...); void log_err(const char *fmt, ...); void vplog(const int level, const char *fmt, va_list args); void plog(const int level, const char *fmt, ...); #endif
Fix the sep and esep attributes to allow additive margins in addition to scaled margins.
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #ifdef __cplusplus extern "C" { #endif #ifndef POLY_H #define POLY_H #include "geometry.h" typedef struct { Point origin; Point corner; int nverts; Point *verts; int kind; } Poly; extern void polyFree(void); extern int polyOverlap(Point, Poly *, Point, Poly *); extern void makePoly(Poly *, Agnode_t *, double); extern void breakPoly(Poly *); #endif #ifdef __cplusplus } #endif
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #ifdef __cplusplus extern "C" { #endif #ifndef POLY_H #define POLY_H #include "geometry.h" typedef struct { Point origin; Point corner; int nverts; Point *verts; int kind; } Poly; extern void polyFree(void); extern int polyOverlap(Point, Poly *, Point, Poly *); extern void makePoly(Poly *, Agnode_t *, float, float); extern void makeAddPoly(Poly *, Agnode_t *, float, float); extern void breakPoly(Poly *); #endif #ifdef __cplusplus } #endif
Disable FASTCALL on Windows since it turned out not to be as effective as hoped. Leaving the definition in the file so we'll know what it was that didn't work, and hopefully find something better in the future.
/* internal.h Internal definitions used by Expat. This is not needed to compile client code. The following definitions are made: FASTCALL -- Used for most internal functions to specify that the fastest possible calling convention be used. inline -- Used for selected internal functions for which inlining may improve performance on some platforms. */ #if defined(__GNUC__) #define FASTCALL __attribute__((stdcall, regparm(3))) #elif defined(WIN32) #define FASTCALL __fastcall #else #define FASTCALL #endif #ifndef XML_MIN_SIZE #if !defined(__cplusplus) && !defined(inline) #ifdef __GNUC__ #define inline __inline #endif /* __GNUC__ */ #endif #endif /* XML_MIN_SIZE */ #ifdef __cplusplus #define inline inline #else #ifndef inline #define inline #endif #endif
/* internal.h Internal definitions used by Expat. This is not needed to compile client code. The following definitions are made: FASTCALL -- Used for most internal functions to specify that the fastest possible calling convention be used. inline -- Used for selected internal functions for which inlining may improve performance on some platforms. */ #if defined(__GNUC__) #define FASTCALL __attribute__((stdcall, regparm(3))) #elif defined(WIN32) /* XXX This seems to have an unexpected negative effect on Windows so we'll disable it for now on that platform. It may be reconsidered for a future release if it can be made more effective. */ /* #define FASTCALL __fastcall */ #endif #ifndef FASTCALL #define FASTCALL #endif #ifndef XML_MIN_SIZE #if !defined(__cplusplus) && !defined(inline) #ifdef __GNUC__ #define inline __inline #endif /* __GNUC__ */ #endif #endif /* XML_MIN_SIZE */ #ifdef __cplusplus #define inline inline #else #ifndef inline #define inline #endif #endif
Add example from website as skipped test
// SKIP PARAM: --sets ana.activated[+] var_eq --sets ana.activated[+] region --sets ana.activated[+] var_eq --enable exp.region-offsets #include <pthread.h> int data[10]; pthread_mutex_t mutexes[10]; void safe_inc(int i) { pthread_mutex_lock(&mutexes[i]); data[i]++; // RACE pthread_mutex_unlock(&mutexes[i]); } void *t_fun(void *arg) { safe_inc(3); safe_inc(4); return NULL; } int main() { for (int i = 0; i < 10; i++) pthread_mutex_init(&mutexes[i], NULL); // Create thread pthread_t id; pthread_create(&id, NULL, t_fun, NULL); pthread_mutex_lock(&mutexes[4]); data[3]++; // RACE data[4]++; // NORACE pthread_mutex_unlock(&mutexes[4]); return 0; }
Test program for duplicating sockets in windows
#include <winsock2.h> #include <assert.h> #define sassert assert void dump() { int err; LPTSTR buf; err = WSAGetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, &buf, 0, NULL); printf("%d %s\n", err, buf); LocalFree(buf); } int main() { SOCKET s1, s2, s1d, s2d; int val, rv, size; WSADATA wsadata; WSAPROTOCOL_INFO pi; rv = WSAStartup(MAKEWORD(2, 2), &wsadata); assert(!rv); s1 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); assert(s1 > 0); val = 1; rv = setsockopt(s1, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)); dump(); sassert(!rv); s2 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); assert(s2 > 0); val = 0; rv = setsockopt(s2, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)); sassert(!rv); size = sizeof(val); rv = getsockopt(s1, SOL_SOCKET, SO_KEEPALIVE, &val, &size); assert(!rv); printf("%d\n", val); sassert(val == 1); rv = getsockopt(s2, SOL_SOCKET, SO_KEEPALIVE, &val, &size); assert(!rv); sassert(val == 0); rv = WSADuplicateSocket(s1, GetCurrentProcessId(), &pi); assert(!rv); s1d = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, &pi, 0, WSA_FLAG_OVERLAPPED); assert(s1d > 0); rv = getsockopt(s1d, SOL_SOCKET, SO_KEEPALIVE, &val, &size); assert(!rv); printf("%d\n", val); sassert(val == 1); rv = WSADuplicateSocket(s2, GetCurrentProcessId(), &pi); assert(!rv); s2d = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, &pi, 0, WSA_FLAG_OVERLAPPED); assert(s2d > 0); rv = getsockopt(s2d, SOL_SOCKET, SO_KEEPALIVE, &val, &size); assert(!rv); printf("%d\n", val); sassert(val == 0); }
Use fpl_null instead of NULL in console demo
/* ------------------------------------------------------------------------------- Name: FPL-Demo | Console Description: A Hello-World Console Application testing Console Output/Input Requirements: No requirements Author: Torsten Spaete Changelog: ## 2018-04-23: - Initial creation of this description block - Changed from C++ to C99 - Forced Visual-Studio-Project to compile in C always - Added read char input ------------------------------------------------------------------------------- */ #define FPL_IMPLEMENTATION #define FPL_NO_WINDOW #define FPL_NO_VIDEO #define FPL_NO_AUDIO #include <final_platform_layer.h> int main(int argc, char *args[]) { if (fplPlatformInit(fplInitFlags_All, NULL)) { fplConsoleOut("Hello World\n"); fplConsoleFormatOut("%s %s %d\n", "Hello", "World", 42); fplConsoleError("Error: Hello World!\n"); fplConsoleFormatError("Error: %s %s %d!\n", "Hello", "World", 42); fplConsoleOut("Press enter a key: "); int key = fplConsoleWaitForCharInput(); fplConsoleFormatOut("You pressed '%c'\n", key); fplPlatformRelease(); } return 0; }
/* ------------------------------------------------------------------------------- Name: FPL-Demo | Console Description: A Hello-World Console Application testing Console Output/Input Requirements: No requirements Author: Torsten Spaete Changelog: ## 2018-04-23: - Initial creation of this description block - Changed from C++ to C99 - Forced Visual-Studio-Project to compile in C always - Added read char input ------------------------------------------------------------------------------- */ #define FPL_IMPLEMENTATION #define FPL_NO_WINDOW #define FPL_NO_VIDEO #define FPL_NO_AUDIO #include <final_platform_layer.h> int main(int argc, char *args[]) { if (fplPlatformInit(fplInitFlags_All, fpl_null)) { fplConsoleOut("Hello World\n"); fplConsoleFormatOut("%s %s %d\n", "Hello", "World", 42); fplConsoleError("Error: Hello World!\n"); fplConsoleFormatError("Error: %s %s %d!\n", "Hello", "World", 42); fplConsoleOut("Press enter a key: "); int key = fplConsoleWaitForCharInput(); fplConsoleFormatOut("You pressed '%c'\n", key); fplPlatformRelease(); } return 0; }
Use the -emit-llvm switch to generate LLVM assembly that can be parsed by the test case.
// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X int X __attribute__((used)); int Y; void foo() __attribute__((used)); void foo() {}
// RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X int X __attribute__((used)); int Y; void foo() __attribute__((used)); void foo() {}
Fix for impicit conversions from double to int and vise versa.
#ifndef FIBONACCI_H #define FIBONACCI_H #include "../function.h" namespace BuiltIn { namespace Optimization { // Class for finding minimum of function with Fibonacci method class Fibonacci : public Function { public: Fibonacci(); Rpn::Operand calculate(FunctionCalculator *calculator, QList<Rpn::Operand> actualArguments); QList<Rpn::Argument> requiredArguments(); Rpn::OperandType returnValueType(); private: struct Interval { Number leftBorder; Number rightBorder; }; Interval m_sourceInterval; FunctionCalculator* m_calculator; QString m_functionName; Number m_resultIntervalLength; Number m_differenceConstant; Number m_iterationsNumber; Number findMinimum(); void initializeIterationsNumber(); Number fibonacciNumber(int position); Number calculateFunction(Number argument); }; } // namespace } // namespace #endif // FIBONACCI_H
#ifndef FIBONACCI_H #define FIBONACCI_H #include "../function.h" namespace BuiltIn { namespace Optimization { // Class for finding minimum of function with Fibonacci method class Fibonacci : public Function { public: Fibonacci(); Rpn::Operand calculate(FunctionCalculator *calculator, QList<Rpn::Operand> actualArguments); QList<Rpn::Argument> requiredArguments(); Rpn::OperandType returnValueType(); private: struct Interval { Number leftBorder; Number rightBorder; }; Interval m_sourceInterval; FunctionCalculator* m_calculator; QString m_functionName; Number m_resultIntervalLength; Number m_differenceConstant; int m_iterationsNumber; Number findMinimum(); void initializeIterationsNumber(); Number fibonacciNumber(int position); Number calculateFunction(Number argument); }; } // namespace } // namespace #endif // FIBONACCI_H
Update client version number and set false for prerelease
#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 7 #define CLIENT_VERSION_BUILD 5 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source #define COPYRIGHT_YEAR 2014 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! #define STRINGIZE(X) DO_STRINGIZE(X) #define DO_STRINGIZE(X) #X #endif // CLIENTVERSION_H
#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 1 #define CLIENT_VERSION_MINOR 0 #define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE false // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source #define COPYRIGHT_YEAR 2014 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! #define STRINGIZE(X) DO_STRINGIZE(X) #define DO_STRINGIZE(X) #X #endif // CLIENTVERSION_H
Add a file that was required for building jansson from CMake.
/* * Copyright (c) 2010-2012 Petri Lehtinen <petri@digip.org> * * Jansson is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. * * * This file specifies a part of the site-specific configuration for * Jansson, namely those things that affect the public API in * jansson.h. * * The configure script copies this file to jansson_config.h and * replaces @var@ substitutions by values that fit your system. If you * cannot run the configure script, you can do the value substitution * by hand. */ #ifndef JANSSON_CONFIG_H #define JANSSON_CONFIG_H /* If your compiler supports the inline keyword in C, JSON_INLINE is defined to `inline', otherwise empty. In C++, the inline is always supported. */ #ifdef __cplusplus #define JSON_INLINE inline #else #define JSON_INLINE inline #endif /* If your compiler supports the `long long` type and the strtoll() library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, otherwise to 0. */ #define JSON_INTEGER_IS_LONG_LONG 1 /* If locale.h and localeconv() are available, define to 1, otherwise to 0. */ #define JSON_HAVE_LOCALECONV 1 #endif
Move include within include guards.
/** * For conditions of distribution and use, see copyright notice in license.txt * * @file WorldLogicInterface.h * @brief */ #include "ServiceInterface.h" #ifndef incl_Interfaces_WorldLogicInterface_h #define incl_Interfaces_WorldLogicInterface_h #include "ForwardDefines.h" #include <QObject> class QString; namespace Foundation { class WorldLogicInterface : public QObject, public ServiceInterface { Q_OBJECT public: /// Default constructor. WorldLogicInterface() {} /// Destructor. virtual ~WorldLogicInterface() {} /// Returns user's avatar entity. virtual Scene::EntityPtr GetUserAvatarEntity() const = 0; /// Returns currently active camera entity. virtual Scene::EntityPtr GetCameraEntity() const = 0; /// Returns entity with certain entity component in it or null if not found. /// @param entity_id Entity ID. /// @param component Type name of the component. virtual Scene::EntityPtr GetEntityWithComponent(uint entity_id, const QString &component) const = 0; /// Hack function for getting EC_AvatarAppearance info to UiModule virtual const QString &GetAvatarAppearanceProperty(const QString &name) const = 0; signals: /// Emitted just before we start to delete world (scene). void AboutToDeleteWorld(); }; } #endif
/** * For conditions of distribution and use, see copyright notice in license.txt * * @file WorldLogicInterface.h * @brief */ #ifndef incl_Interfaces_WorldLogicInterface_h #define incl_Interfaces_WorldLogicInterface_h #include "ServiceInterface.h" #include "ForwardDefines.h" #include <QObject> class QString; namespace Foundation { class WorldLogicInterface : public QObject, public ServiceInterface { Q_OBJECT public: /// Default constructor. WorldLogicInterface() {} /// Destructor. virtual ~WorldLogicInterface() {} /// Returns user's avatar entity. virtual Scene::EntityPtr GetUserAvatarEntity() const = 0; /// Returns currently active camera entity. virtual Scene::EntityPtr GetCameraEntity() const = 0; /// Returns entity with certain entity component in it or null if not found. /// @param entity_id Entity ID. /// @param component Type name of the component. virtual Scene::EntityPtr GetEntityWithComponent(uint entity_id, const QString &component) const = 0; /// Hack function for getting EC_AvatarAppearance info to UiModule virtual const QString &GetAvatarAppearanceProperty(const QString &name) const = 0; signals: /// Emitted just before we start to delete world (scene). void AboutToDeleteWorld(); }; } #endif
Change macro to let user choose output stream
#ifndef lilthumb #define lilthumb #include <ctime> namespace lilthumb{ std::string timeString() { time_t rawtime; struct tm * timeinfo; char buffer[80]; time (&rawtime); timeinfo = localtime(&rawtime); strftime(buffer,80,"%d-%m-%Y %I:%M:%S",timeinfo); std::string str(buffer); return str; } } #define logger(message) std::cerr << lilthumb::timeString() << " | "<< message << std::endl; #endif
#ifndef lilthumb #define lilthumb #include <ctime> namespace lilthumb{ std::string timeString() { time_t rawtime; struct tm * timeinfo; char buffer[80]; time (&rawtime); timeinfo = localtime(&rawtime); strftime(buffer,80,"%d-%m-%Y %I:%M:%S",timeinfo); std::string str(buffer); return str; } } #define logger(stream,message) stream << lilthumb::timeString() << " | "<< message << std::endl; #endif
Break lines properly on serial console.
#include <proto/dos.h> #include <proto/exec.h> #include <proto/graphics.h> #include <exec/execbase.h> #include <graphics/gfxbase.h> #include "system/check.h" bool SystemCheck() { bool kickv40 = SysBase->LibNode.lib_Version >= 40; bool chipaga = GfxBase->ChipRevBits0 & (GFXF_AA_ALICE|GFXF_AA_LISA); bool cpu68040 = SysBase->AttnFlags & AFF_68040; bool fpu68882 = SysBase->AttnFlags & AFF_68882; Printf("System check:\n"); Printf(" - Kickstart v40 : %s\n", (ULONG)(kickv40 ? "yes" : "no")); Printf(" - ChipSet AGA : %s\n", (ULONG)(chipaga ? "yes" : "no")); Printf(" - CPU 68040 : %s\n", (ULONG)(cpu68040 ? "yes" : "no")); Printf(" - FPU 68882 : %s\n", (ULONG)(fpu68882 ? "yes" : "no")); return (kickv40 && cpu68040 && fpu68882 && chipaga); }
#include <proto/dos.h> #include <proto/exec.h> #include <proto/graphics.h> #include <exec/execbase.h> #include <graphics/gfxbase.h> #include "system/check.h" bool SystemCheck() { bool kickv40 = SysBase->LibNode.lib_Version >= 40; bool chipaga = GfxBase->ChipRevBits0 & (GFXF_AA_ALICE|GFXF_AA_LISA); bool cpu68040 = SysBase->AttnFlags & AFF_68040; bool fpu68882 = SysBase->AttnFlags & AFF_68882; Printf("System check:\r\n"); Printf(" - Kickstart v40 : %s\r\n", (ULONG)(kickv40 ? "yes" : "no")); Printf(" - ChipSet AGA : %s\r\n", (ULONG)(chipaga ? "yes" : "no")); Printf(" - CPU 68040 : %s\r\n", (ULONG)(cpu68040 ? "yes" : "no")); Printf(" - FPU 68882 : %s\r\n", (ULONG)(fpu68882 ? "yes" : "no")); return (kickv40 && cpu68040 && fpu68882 && chipaga); }
Use aligned alloc for test allocation.
#pragma once #include "Jitter.h" #define TEST_VERIFY(a) if(!(a)) { int* p = 0; (*p) = 0; } class CTest { public: virtual ~CTest() {} virtual void Run() = 0; virtual void Compile(Jitter::CJitter&) = 0; #ifdef _MSC_VER //Overload operator new and delete to make sure we get proper 16-byte aligned structures //C++11 has support for aligned struct/classes, but VC++2013 doesn't support them void* operator new(size_t allocSize) { return _aligned_malloc(allocSize, 16); } void operator delete(void* ptr) { _aligned_free(ptr); } #endif };
#pragma once #include "AlignedAlloc.h" #include "Jitter.h" #define TEST_VERIFY(a) if(!(a)) { int* p = 0; (*p) = 0; } class CTest { public: virtual ~CTest() {} virtual void Run() = 0; virtual void Compile(Jitter::CJitter&) = 0; void* operator new(size_t allocSize) { return framework_aligned_alloc(allocSize, 0x10); } void operator delete(void* ptr) { framework_aligned_free(ptr); } };
Exit when input line is empty
#include <stdio.h> #include <string.h> #include <math.h> #include "calc.h" #include "input.h" int main(void) { while (1){ char input[65536]; double ans; read_line(input); if (strcmp(input, "exit") == 0 || strcmp(input, "quit") == 0){ break; } ans = calc(input, 0); if (floor(ans) == ans){ printf("%.0f\n", ans); } else{ printf("%f\n", calc(input, 0)); } } return (0); }
#include <stdio.h> #include <string.h> #include <math.h> #include "calc.h" #include "input.h" int main(void) { while (1){ char input[65536]; double ans; read_line(input); if (strlen(input) == 0 || strcmp(input, "exit") == 0 || strcmp(input, "quit") == 0){ break; } ans = calc(input, 0); if (floor(ans) == ans){ printf("%.0f\n", ans); } else{ printf("%f\n", calc(input, 0)); } } return (0); }
Disable floating point exceptions on Borland compiler
#include <stdio.h> #include <float.h> int main(int argc, char *argv[]) { char *me; float qnan, zero; int i; me = argv[0]; if (sizeof(float) != sizeof(int)) { fprintf(stderr, "%s: MADNESS: sizeof(float)=%d != sizeof(int)=%d\n", me, (int)sizeof(float), (int)sizeof(int)); return -1; } zero = 0; qnan=zero/zero; i=*(int*)(&qnan); printf("-DTEEM_QNANHIBIT=%d\n", (i >> 22) & 1); return (int)((i >> 22) & 1); }
#include <stdio.h> #include <float.h> #if defined(__BORLANDC__) # include <math.h> # include <float.h> #endif int main(int argc, char *argv[]) { #if defined(__BORLANDC__) // Disable floating point exceptions in Borland _control87(MCW_EM, MCW_EM); #endif // defined(__BORLANDC__) char *me; float qnan, zero; int i; me = argv[0]; if (sizeof(float) != sizeof(int)) { fprintf(stderr, "%s: MADNESS: sizeof(float)=%d != sizeof(int)=%d\n", me, (int)sizeof(float), (int)sizeof(int)); return -1; } zero = 0; qnan=zero/zero; i=*(int*)(&qnan); printf("-DTEEM_QNANHIBIT=%d\n", (i >> 22) & 1); return (int)((i >> 22) & 1); }
Use die and return instead of exiting.
#include <ugens.h> #include <stdio.h> /* these 3 defined in makegen.c */ extern double *farrays[]; extern int sizeof_farray[]; extern int f_goto[]; int fsize(int genno) /* returns the size of function number genno */ { if(!sizeof_farray[f_goto[genno]]) { fprintf(stderr,"fsize: You haven't allocated function %d yet!\n",genno); closesf(); } return(sizeof_farray[f_goto[genno]]); }
#include <ugens.h> #include <stdio.h> /* these 3 defined in makegen.c */ extern double *farrays[]; extern int sizeof_farray[]; extern int f_goto[]; /* returns the size of function number genno */ int fsize(int genno) { if (!sizeof_farray[f_goto[genno]]) { die("fsize", "You haven't allocated function %d yet!", genno); return -1; } return sizeof_farray[f_goto[genno]]; }
Add LICENSE and source headers to any-sketch repo.
#ifndef SRC_MAIN_CC_ANY_SKETCH_UTIL_MACROS_H_ #define SRC_MAIN_CC_ANY_SKETCH_UTIL_MACROS_H_ #define RETURN_IF_ERROR(status) \ do { \ Status _status = (status); \ if (!_status.ok()) return _status; \ } while (0) #endif // SRC_MAIN_CC_ANY_SKETCH_UTIL_MACROS_H_
/* * Copyright 2020 The Any Sketch Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SRC_MAIN_CC_ANY_SKETCH_UTIL_MACROS_H_ #define SRC_MAIN_CC_ANY_SKETCH_UTIL_MACROS_H_ #define RETURN_IF_ERROR(status) \ do { \ Status _status = (status); \ if (!_status.ok()) return _status; \ } while (0) #endif // SRC_MAIN_CC_ANY_SKETCH_UTIL_MACROS_H_
Modify the SHMT version to 1.0.1dev
#ifndef PHP_SHMT_H #define PHP_SHMT_H #define PHP_SHMT_EXTNAME "SHMT" #define PHP_SHMT_EXTVER "1.0" #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ extern zend_module_entry shmt_module_entry; #define phpext_shmt_ptr &shmt_module_entry; #endif /* PHP_SHMT_H */
#ifndef PHP_SHMT_H #define PHP_SHMT_H #define PHP_SHMT_EXTNAME "SHMT" #define PHP_SHMT_EXTVER "1.0.1dev" #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ extern zend_module_entry shmt_module_entry; #define phpext_shmt_ptr &shmt_module_entry; #endif /* PHP_SHMT_H */
Change methods in DataStore to non-static anymore (it is alr a singleton)
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <deque> #include <functional> #include "boost/variant.hpp" #include "task_typedefs.h" #include "internal/operation.h" #include "transaction.h" namespace You { namespace DataStore { namespace UnitTests {} class DataStore { friend class Transaction; public: Transaction&& begin(); // Modifying methods static bool post(TaskId, SerializedTask&); static bool put(TaskId, SerializedTask&); static bool erase(TaskId); static std::vector<SerializedTask> getAllTask(); private: static DataStore& get(); bool isServing = false; std::deque<Internal::IOperation> operationsQueue; }; } // namespace DataStore } // namespace You #endif // YOU_DATASTORE_DATASTORE_H_
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <deque> #include <functional> #include "boost/variant.hpp" #include "task_typedefs.h" #include "internal/operation.h" #include "transaction.h" namespace You { namespace DataStore { namespace UnitTests {} class DataStore { friend class Transaction; public: Transaction&& begin(); // Modifying methods bool post(TaskId, SerializedTask&); bool put(TaskId, SerializedTask&); bool erase(TaskId); std::vector<SerializedTask> getAllTask(); private: static DataStore& get(); bool isServing = false; std::deque<Internal::IOperation> operationsQueue; }; } // namespace DataStore } // namespace You #endif // YOU_DATASTORE_DATASTORE_H_
Add internal representation of a BuxtonKey
/* * This file is part of buxton. * * Copyright (C) 2013 Intel Corporation * * buxton is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. */ #pragma once #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "buxton.h" #include "buxtonstring.h" /** * Represents a data key in Buxton */ typedef struct BuxtonKey { BuxtonString group; /**<Value of the key's group */ BuxtonString name; /**<Value of the key's name */ BuxtonString layer; /**<Value of the key's layer */ BuxtonDataType type; /**<Type of value associated with key */ } _BuxtonKey; /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
Add a more elaborate example of acc computation.
#include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { const int sample = 10000; size_t size = sample * sizeof(int); int *restrict a1, *restrict a2, *restrict a3; a1 = (int*) malloc(size); a2 = (int*) malloc(size); a3 = (int*) malloc(size); int sum = 0; int i; #pragma acc data create(i, a1[0:sample], a2[0:sample], a3[0:sample]), copyin(sample), copy(sum) { #pragma acc parallel loop for (i = 0; i < sample; ++i) { a1[i] = a2[i] = 1; } #pragma acc parallel loop for (i = 0; i < sample; ++i) { a3[i] = a1[i] + a2[i]; } #pragma acc parallel loop reduction(+:sum) for (i = 0; i < sample; ++i) { sum += a3[i]; } } free(a1); free(a2); free(a3); printf("Sample size: %d | Sum: %d\n", sample, sum); }
Use testing API instead of duplicating it
#include <gtk/gtk.h> static void test_type (GType t) { GtkWidget *w; AtkObject *a; if (g_type_is_a (t, GTK_TYPE_WIDGET)) { w = (GtkWidget *)g_object_new (t, NULL); a = gtk_widget_get_accessible (w); g_assert (GTK_IS_ACCESSIBLE (a)); g_assert (gtk_accessible_get_widget (GTK_ACCESSIBLE (a)) == w); g_object_unref (w); } } int main (int argc, char *argv[]) { GType *tp; gint i; gtk_init (&argc, &argv); tp = g_new0 (GType, 1000); #undef GDK_WINDOWING_X11 #include "../gtktypefuncs.c" *tp = 0; for (i = 0; tp[i]; i++) test_type (tp[i]); return 0; }
#include <gtk/gtk.h> static void test_type (GType t) { GtkWidget *w; AtkObject *a; if (g_type_is_a (t, GTK_TYPE_WIDGET)) { w = (GtkWidget *)g_object_new (t, NULL); a = gtk_widget_get_accessible (w); g_assert (GTK_IS_ACCESSIBLE (a)); g_assert (gtk_accessible_get_widget (GTK_ACCESSIBLE (a)) == w); g_object_unref (w); } } int main (int argc, char *argv[]) { const GType *tp; guint i, n; gtk_init (&argc, &argv); tp = gtk_test_list_all_types (&n); for (i = 0; i < n; n++) test_type (tp[i]); return 0; }
Add global access to test subsystem
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2012 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <kotaka/log.h> #include <kotaka/paths.h> inherit LIB_INITD; inherit UTILITY_COMPILE; static void create() { LOGD->post_message("test", LOG_DEBUG, "Test subsystem loading..."); load_dir("obj", 1); load_dir("sys", 1); LOGD->post_message("test", LOG_DEBUG, "Test subsystem loaded"); }
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2012 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <kotaka/log.h> #include <kotaka/paths.h> inherit LIB_INITD; inherit UTILITY_COMPILE; static void create() { KERNELD->set_global_access("Test", 1); LOGD->post_message("test", LOG_DEBUG, "Test subsystem loading..."); load_dir("obj", 1); load_dir("sys", 1); LOGD->post_message("test", LOG_DEBUG, "Test subsystem loaded"); }
Change IBOutlet attributes from readonly to weak
// // SMViewController.h // SMPageControl // // Created by Jerry Jones on 10/13/12. // Copyright (c) 2012 Spaceman Labs. All rights reserved. // #import <UIKit/UIKit.h> #import "SMPageControl.h" @interface SMViewController : UIViewController @property (nonatomic, readonly) IBOutlet UIScrollView *scrollview; @property (nonatomic, readonly) IBOutlet UIPageControl *pageControl; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl1; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl2; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl3; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl4; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl5; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl6; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl7; @property (nonatomic, readonly) IBOutlet SMPageControl *spacePageControl8; @end
// // SMViewController.h // SMPageControl // // Created by Jerry Jones on 10/13/12. // Copyright (c) 2012 Spaceman Labs. All rights reserved. // #import <UIKit/UIKit.h> #import "SMPageControl.h" @interface SMViewController : UIViewController @property (nonatomic, weak) IBOutlet UIScrollView *scrollview; @property (nonatomic, weak) IBOutlet UIPageControl *pageControl; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl1; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl2; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl3; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl4; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl5; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl6; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl7; @property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl8; @end
Update Copyright. Delete erroneous "Module Name" line.
/** @file Header file that supports Framework extension to UEFI/PI for DXE modules. This header file must include Framework extension definitions common to DXE modules. Copyright (c) 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: FrameworkDxe.h **/ #ifndef _FRAMEWORK_DXE_H_ #define _FRAMEWORK_DXE_H_ #include <FrameworkPei.h> #include <Framework/DxeCis.h> #include <Framework/FrameworkInternalFormRepresentation.h> #endif
/** @file Header file that supports Framework extension to UEFI/PI for DXE modules. This header file must include Framework extension definitions common to DXE modules. Copyright (c) 2007-2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _FRAMEWORK_DXE_H_ #define _FRAMEWORK_DXE_H_ #include <FrameworkPei.h> #include <Framework/DxeCis.h> #include <Framework/FrameworkInternalFormRepresentation.h> #endif
Remove simpleLanguageCode (unused and not implemented).
// // This file is part of the Marble Desktop Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn <tackat@kde.org> // Copyright 2007 Inge Wallin <ingwa@kde.org> // #ifndef MARBLE_LOCALE_H #define MARBLE_LOCALE_H #include "marble_export.h" #include "global.h" namespace Marble { class MarbleLocalePrivate; /** * @short A class that contains all localization stuff for Marble. * * The class stores properties like the Distance Unit. */ class MARBLE_EXPORT MarbleLocale { public: MarbleLocale(); ~MarbleLocale(); void setDistanceUnit( DistanceUnit distanceUnit ); DistanceUnit distanceUnit() const; void setMeasureSystem( MeasureSystem measureSystem ); MeasureSystem measureSystem() const; static QString languageCode(); static QString simpleLanguageCode(); private: Q_DISABLE_COPY( MarbleLocale ) MarbleLocalePrivate * const d; }; } #endif // MARBLE_LOCALE_H
// // This file is part of the Marble Desktop Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn <tackat@kde.org> // Copyright 2007 Inge Wallin <ingwa@kde.org> // #ifndef MARBLE_LOCALE_H #define MARBLE_LOCALE_H #include "marble_export.h" #include "global.h" namespace Marble { class MarbleLocalePrivate; /** * @short A class that contains all localization stuff for Marble. * * The class stores properties like the Distance Unit. */ class MARBLE_EXPORT MarbleLocale { public: MarbleLocale(); ~MarbleLocale(); void setDistanceUnit( DistanceUnit distanceUnit ); DistanceUnit distanceUnit() const; void setMeasureSystem( MeasureSystem measureSystem ); MeasureSystem measureSystem() const; static QString languageCode(); private: Q_DISABLE_COPY( MarbleLocale ) MarbleLocalePrivate * const d; }; } #endif // MARBLE_LOCALE_H
Add empty dummy implementation of ifd handler
#include <ifdhandler.h>
#include <ifdhandler.h> #include <stdio.h> RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR DeviceName) { return IFD_NO_SUCH_DEVICE; } RESPONSECODE IFDHCreateChannel(DWORD Lun, DWORD Channel) { char buf[40]; snprintf(buf, sizeof(buf), "/dev/o2scr%d", Channel); return IFDHCreateChannelByName(Lun, buf); } RESPONSECODE IFDHCloseChannel(DWORD Lun) { return IFD_SUCCESS; } RESPONSECODE IFDHGetCapabilities (DWORD Lun, DWORD Tag, PDWORD Length, PUCHAR Value) { // FIXME (*Length) = 0; return IFD_ERROR_TAG; } RESPONSECODE IFDHSetCapabilities (DWORD Lun, DWORD Tag, DWORD Length, PUCHAR Value) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHPowerICC (DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD AtrLength) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHTransmitToICC (DWORD Lun, SCARD_IO_HEADER SendPci, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, PDWORD RxLength, PSCARD_IO_HEADER RecvPci) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHICCPresence (DWORD Lun) { return IFD_ICC_NOT_PRESENT; } RESPONSECODE IFDHControl (DWORD Lun, DWORD dwControlCode, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, DWORD RxLength, LPDWORD pdwBytesReturned) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHSetProtocolParameters (DWORD Lun, DWORD Protocol, UCHAR Flags, UCHAR PTS1, UCHAR PTS2, UCHAR PTS3) { return IFD_NOT_SUPPORTED; }
Save program path before doing setprocname().
#include <stdlib.h> #include <unistd.h> #include <signal.h> #include <sys/wait.h> #include "common.h" static void reap(char *argv[]); static pid_t spawn(char *argv[]); extern void init(char *argv[]); int main(int argc, char *argv[]) { const char *name = getenv("PROCNAME"); if (name && *name) setprocname(name, argv[0]); if (getpid() == 1) { /* parent process */ reap(argv); } else { /* child process */ prepare_env(); init(argv + 1); } return 1; } static void reap(char *argv[]) { pid_t child = 0; for (;;) { if (!child) child = spawn(argv); pid_t died = wait(NULL); if (died > 0 && died == child) child = 0; } } static pid_t spawn(char *argv[]) { /* block signals so child process can't wreak havoc for parent */ sigset_t sigs; sigfillset(&sigs); sigprocmask(SIG_BLOCK, &sigs, 0); pid_t pid = fork(); if (!pid) { sigprocmask(SIG_UNBLOCK, &sigs, 0); execv(argv[0], argv); } return pid; }
#include <stdlib.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <sys/wait.h> #include "common.h" static void reap(char *argv[]); static pid_t spawn(char *argv[]); extern void init(char *argv[]); const char *path; int main(int argc, char *argv[]) { path = strdup(argv[0]); const char *name = getenv("PROCNAME"); if (name && *name) setprocname(name, argv[0]); if (getpid() == 1) { /* parent process */ reap(argv); } else { /* child process */ prepare_env(); init(argv + 1); } return 1; } static void reap(char *argv[]) { pid_t child = 0; for (;;) { if (!child) child = spawn(argv); pid_t died = wait(NULL); if (died > 0 && died == child) child = 0; } } static pid_t spawn(char *argv[]) { /* block signals so child process can't wreak havoc for parent */ sigset_t sigs; sigfillset(&sigs); sigprocmask(SIG_BLOCK, &sigs, 0); pid_t pid = fork(); if (!pid) { sigprocmask(SIG_UNBLOCK, &sigs, 0); execv(path, argv); } return pid; }
Add a little bit of c++ awareness to the main header
#include "generic.h" #include "dict.h" #include "vector.h" #include "list.h" #include "htbl.h" #include "dsu.h" #include "heap.h" #include "bst.h" #include "sort.h" #include "heap.h" #include "queue.h" #include "mem.h" #include "bitmap.h" #include "string_utils.h" #include "file_utils.h"
#if defined(__cplusplus) extern "C" { #endif #include "generic.h" #include "dict.h" #include "vector.h" #include "list.h" #include "htbl.h" #include "dsu.h" #include "heap.h" #include "bst.h" #include "sort.h" #include "heap.h" #include "queue.h" #include "mem.h" #include "bitmap.h" #include "string_utils.h" #include "file_utils.h" #if defined(__cplusplus) } #endif
Make search results storable in database as metadata
#import <Foundation/Foundation.h> @class MWKSearchResult; @interface WMFRelatedSearchResults : NSObject @property (nonatomic, strong, readonly) NSURL *siteURL; @property (nonatomic, strong, readonly) NSArray<MWKSearchResult *> *results; - (instancetype)initWithURL:(NSURL *)URL results:(NSArray *)results; @end
#import <Mantle/Mantle.h> @class MWKSearchResult; @interface WMFRelatedSearchResults : MTLModel @property (nonatomic, strong, readonly) NSURL *siteURL; @property (nonatomic, strong, readonly) NSArray<MWKSearchResult *> *results; - (instancetype)initWithURL:(NSURL *)URL results:(NSArray *)results; @end
Change indent to 4 spaces.
/* * Copyright 2015, Wink Saville * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. */ #include <sel4/printf.h> /** * No parameters are passed to main, the return * value is ignored and the program hangs. */ int main(void) { seL4_Printf("Hello, World!\n"); return 0; }
/* * Copyright 2015, Wink Saville * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. */ #include <sel4/printf.h> /** * No parameters are passed to main, the return * value is ignored and the program hangs. */ int main(void) { seL4_Printf("Hello, World!\n"); return 0; }
Include the OS X specific header to use OS specific macros.
// Copyright 2013 by Tetsuo Kiso // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef FAST_ALIGN_PORT_H_ #define FAST_ALIGN_PORT_H_ // As of OS X 10.9, it looks like C++ TR1 headers are removed from the // search paths. Instead, we can include C++11 headers. #if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 #include <unordered_map> #include <functional> #else // Assuming older OS X, Linux or similar platforms #include <tr1/unordered_map> #include <tr1/functional> namespace std { using tr1::unordered_map; using tr1::hash; } // namespace std #endif #endif // FAST_ALIGN_PORT_H_
// Copyright 2013 by Tetsuo Kiso // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef FAST_ALIGN_PORT_H_ #define FAST_ALIGN_PORT_H_ // As of OS X 10.9, it looks like C++ TR1 headers are removed from the // search paths. Instead, we can include C++11 headers. #if defined(__APPLE__) #include <AvailabilityMacros.h> #endif #if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && \ MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 #include <unordered_map> #include <functional> #else // Assuming older OS X, Linux or similar platforms #include <tr1/unordered_map> #include <tr1/functional> namespace std { using tr1::unordered_map; using tr1::hash; } // namespace std #endif #endif // FAST_ALIGN_PORT_H_
Add BST Tree Root function declaration
#include <stdlib.h> #ifndef __BST_H__ #define __BST_H__ struct BSTNode; struct BST; typedef struct BSTNode BSTNode; typedef struct BST BST; BST* BST_Create(void); BSTNode* BSTNode_Create(void* k); void BST_Inorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Preorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Postorder_Tree_Walk(BST* T, void (f)(void*)); BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Tree_Minimum(BSTNode* n); BSTNode* BST_Tree_Maximum(BSTNode* n); #endif
#include <stdlib.h> #ifndef __BST_H__ #define __BST_H__ struct BSTNode; struct BST; typedef struct BSTNode BSTNode; typedef struct BST BST; BST* BST_Create(void); BSTNode* BSTNode_Create(void* k); void BST_Inorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Preorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Postorder_Tree_Walk(BST* T, void (f)(void*)); BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Tree_Minimum(BSTNode* n); BSTNode* BST_Tree_Maximum(BSTNode* n); BSTNode* BST_Tree_Root(BST* T); #endif
Add common header for library functions
#include "generic.h" #include "dict.h" #include "vector.h" #include "list.h" #include "htbl.h" #include "dsu.h" #include "bst.h" #include "sort.h" #include "heap.h" #include "queue.h" #include "mem.h" #include "string_utils.h" #include "file_utils.h"
Update header include paths to support React Native 0.40
#import "RCTBridgeModule.h" @interface RNFlurryAnalytics : NSObject <RCTBridgeModule> @end
#import <React/RCTBridgeModule.h> @interface RNFlurryAnalytics : NSObject <RCTBridgeModule> @end
Install GDT and remove division by 0
#include <stddef.h> #include <stdint.h> #include "./arch/x86/idt.h" #include <terminal.h> #include <kabort.h> #include <kassert.h> void kernel_main() { term_initialize(); idt_install(); kputs("Interrupt?"); int i = 0; int b = 128; int d = 1; d = b / i; while (1) ; }
#include <stddef.h> #include <stdint.h> #include "./arch/x86/gdt.h" #include "./arch/x86/idt.h" #include <terminal.h> #include <kabort.h> #include <kassert.h> void kernel_main() { term_initialize(); gdt_install(); idt_install(); kputs("Hello kernel!"); while (1) { }; }
Update for pragma syntax - Only unsupported on older versions of GCC
// // TGGeoPoint.h // tangram // // Created by Karim Naaji on 10/27/16. // // #ifndef TGGeoPoint_h #define TGGeoPoint_h struct TGGeoPoint { double longitude; double latitude; }; typedef struct TGGeoPoint TGGeoPoint; static inline TGGeoPoint TGGeoPointMake(double lat, double lon) { TGGeoPoint p; p.latitude = lat; p.longitude = lon; return p; } #endif /* TGGeoPoint_h */
// // TGGeoPoint.h // tangram // // Created by Karim Naaji on 10/27/16. // // #pragma once struct TGGeoPoint { double longitude; double latitude; }; typedef struct TGGeoPoint TGGeoPoint; static inline TGGeoPoint TGGeoPointMake(double lat, double lon) { TGGeoPoint p; p.latitude = lat; p.longitude = lon; return p; }
Fix typo dmx_out instead of dmx_in
#include "usbdmx.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char ** argv) { int result; int set_value; int count = 0; TDMXArray dmx_out; TDMXArray dmx_in; // Open Interface in Mode 6 (PC Out -> DMX Out & DMX In -> PC In) // See head of this file for details result = OpenInterface(&dmx_out, &dmx_in, 6); if(result == 0) { // Open failed printf("Unable to open Interface\n"); exit(1); } while(1) { set_value = count % 256; dmx_out[0] = set_value; dmx_out[1] = set_value; dmx_out[2] = set_value; usleep(50000); // Wait 50 ms if ( (dmx_in[0] != set_value) || (dmx_in[1] != set_value) || (dmx_out[2] != set_value)) { printf("FAIL %d\n", count); } else { count ++; printf("Still working %d\n", count); } } return 0; }
#include "usbdmx.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char ** argv) { int result; int set_value; int count = 0; TDMXArray dmx_out; TDMXArray dmx_in; // Open Interface in Mode 6 (PC Out -> DMX Out & DMX In -> PC In) // See head of this file for details result = OpenInterface(&dmx_out, &dmx_in, 6); if(result == 0) { // Open failed printf("Unable to open Interface\n"); exit(1); } while(1) { set_value = count % 256; dmx_out[0] = set_value; dmx_out[1] = set_value; dmx_out[2] = set_value; usleep(50000); // Wait 50 ms if ( (dmx_in[0] != set_value) || (dmx_in[1] != set_value) || (dmx_in[2] != set_value)) { printf("FAIL %d\n", count); } else { count ++; printf("Still working %d\n", count); } } return 0; }
Add macro MODE and MODE_DEV, MODE_TESTFLIGHT, MODE_DISTRIBUTION
#if defined TESTFLIGHT #define TESTFLIGHT YES #define DISTRIBUTION NO #elif defined DEBUG #define TESTFLIGHT NO #define DISTRIBUTION NO #else #define TESTFLIGHT NO #define DISTRIBUTION YES #endif #define CLIP(X,min,max) MIN(MAX(X, min), max) #define white [UIColor whiteColor] #define yellow [UIColor yellowColor] #define transparent [UIColor clearColor] #define black [UIColor blackColor] #if defined __MAC_OS_X_VERSION_MAX_ALLOWED #define PLATFORM_OSX #define UIApplicationDelegate NSApplicationDelegate #define UIView NSView #define UIApplication NSApplication #elif defined __IPHONE_OS_VERSION_MAX_ALLOWED #define PLATFORM_IOS #endif void error(NSError* err); NSError* makeError(NSString* localMessage); typedef void (^Block)(); typedef void (^Callback)(NSError* err, NSDictionary* res); typedef void (^StringCallback)(NSError* err, NSString* res); typedef void (^ArrayCallback)(NSError* err, NSArray* res); typedef void (^DataCallback)(NSError* err, NSData* data); typedef void (^ImageCallback)(NSError* err, UIImage* image); typedef void (^ViewCallback)(NSError* err, UIView* view); void after(CGFloat delayInSeconds, Block block); void vibrateDevice(); NSString* concat(id arg1, ...); NSNumber* num(int i);
#define MODE_DEV 1 #define MODE_TESTFLIGHT 2 #define MODE_DISTRIBUTION 3 #if defined TESTFLIGHT #define MODE MODE_TESTFLIGHT #elif defined DEBUG #define MODE MODE_DEV #else #define MODE MODE_DISTRIBUTION #endif #define IS_DISTRIBUTION (MODE == MODE_DISTRIBUTION) #define CLIP(X,min,max) MIN(MAX(X, min), max) #define white [UIColor whiteColor] #define yellow [UIColor yellowColor] #define transparent [UIColor clearColor] #define black [UIColor blackColor] #if defined __MAC_OS_X_VERSION_MAX_ALLOWED #define PLATFORM_OSX #define UIApplicationDelegate NSApplicationDelegate #define UIView NSView #define UIApplication NSApplication #elif defined __IPHONE_OS_VERSION_MAX_ALLOWED #define PLATFORM_IOS #endif void error(NSError* err); NSError* makeError(NSString* localMessage); typedef void (^Block)(); typedef void (^Callback)(NSError* err, NSDictionary* res); typedef void (^StringCallback)(NSError* err, NSString* res); typedef void (^ArrayCallback)(NSError* err, NSArray* res); typedef void (^DataCallback)(NSError* err, NSData* data); typedef void (^ImageCallback)(NSError* err, UIImage* image); typedef void (^ViewCallback)(NSError* err, UIView* view); void after(CGFloat delayInSeconds, Block block); void vibrateDevice(); NSString* concat(id arg1, ...); NSNumber* num(int i);
Fix wrong result caused by newline character.
#include <X11/Xft/Xft.h> #include <X11/Xlib.h> #include <X11/extensions/Xrender.h> #include <fontconfig/fontconfig.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char** argv) { if (argc < 3) { printf("xftwidth font string\n"); return 1; } Display *dpy; XftFont *fn; XGlyphInfo ext; FcChar8 *str; char *name = argv[1]; size_t len = strlen(argv[2]) + 1; str = (FcChar8*) malloc(len * sizeof(FcChar8)); strncpy((char*)str, argv[2], len); dpy = XOpenDisplay(NULL); fn = XftFontOpenName(dpy, 0, name); if (fn == NULL) { printf("Font not found.\n"); return 1; } XftTextExtents8(dpy, fn, str, (int)len, &ext); printf("%d\n", ext.width); XCloseDisplay(dpy); free((void*)str); return 0; }
#include <X11/Xft/Xft.h> #include <X11/Xlib.h> #include <X11/extensions/Xrender.h> #include <fontconfig/fontconfig.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char** argv) { if (argc < 3) { printf("xftwidth font string\n"); return 1; } Display *dpy; XftFont *fn; XGlyphInfo ext; FcChar8 *str; char *name = argv[1]; size_t len = strlen(argv[2]); str = (FcChar8*) malloc(len * sizeof(FcChar8)); strncpy((char*)str, argv[2], len); dpy = XOpenDisplay(NULL); fn = XftFontOpenName(dpy, 0, name); if (fn == NULL) { printf("Font not found.\n"); return 1; } XftTextExtents8(dpy, fn, str, (int)len, &ext); printf("%d\n", ext.width); XCloseDisplay(dpy); free((void*)str); return 0; }
Add comment describing semantics of return value from SlimeFillerFilter::get_filter().
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/stllike/hash_map.h> #include <optional> namespace search::docsummary { /* * Class filtering which fields to render in a struct field. */ class SlimeFillerFilter { vespalib::hash_map<vespalib::string, std::unique_ptr<SlimeFillerFilter>> _filter; std::optional<const SlimeFillerFilter*> get_filter(vespalib::stringref field_name) const; public: SlimeFillerFilter(); ~SlimeFillerFilter(); static std::optional<const SlimeFillerFilter*> get_filter(const SlimeFillerFilter*, vespalib::stringref field_name); bool empty() const; SlimeFillerFilter& add(vespalib::stringref field_path); }; }
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/stllike/hash_map.h> #include <optional> namespace search::docsummary { /* * Class filtering which fields to render in a struct field. */ class SlimeFillerFilter { vespalib::hash_map<vespalib::string, std::unique_ptr<SlimeFillerFilter>> _filter; std::optional<const SlimeFillerFilter*> get_filter(vespalib::stringref field_name) const; public: SlimeFillerFilter(); ~SlimeFillerFilter(); /* * If field is blocked by the filter then the return value is not set, * otherwise it is set to the filter for the next level. */ static std::optional<const SlimeFillerFilter*> get_filter(const SlimeFillerFilter* filter, vespalib::stringref field_name); bool empty() const; SlimeFillerFilter& add(vespalib::stringref field_path); }; }
Add missing math.h include for M_PHI definition
#ifndef LAGER_COMMON_SPHERICAL_COORDINATES_H #define LAGER_COMMON_SPHERICAL_COORDINATES_H /* * Code based on: * http://stackoverflow.com/questions/17016175/c-unordered-map-using-a-custom-class-type-as-the-key */ struct SphericalCoordinates { int phi; int theta; bool operator==(const SphericalCoordinates &other) const { return (phi == other.phi && theta == other.theta); } }; /* * Code based on: * http://stackoverflow.com/questions/17016175/c-unordered-map-using-a-custom-class-type-as-the-key */ namespace std { template<> struct hash<SphericalCoordinates> { std::size_t operator()(const SphericalCoordinates& k) const { // Compute individual hash values for mPhi and mTheta // and combine them using XOR and bit shifting: return ((hash<int>()(k.phi) ^ (hash<int>()(k.theta) << 1))); } }; } double DegreesToRadians(double degrees) { return (degrees/180 * M_PI); } #endif /* LAGER_COMMON_SPHERICAL_COORDINATES_H */
#ifndef LAGER_COMMON_SPHERICAL_COORDINATES_H #define LAGER_COMMON_SPHERICAL_COORDINATES_H #include <math.h> /* * Code based on: * http://stackoverflow.com/questions/17016175/c-unordered-map-using-a-custom-class-type-as-the-key */ struct SphericalCoordinates { int phi; int theta; bool operator==(const SphericalCoordinates &other) const { return (phi == other.phi && theta == other.theta); } }; /* * Code based on: * http://stackoverflow.com/questions/17016175/c-unordered-map-using-a-custom-class-type-as-the-key */ namespace std { template<> struct hash<SphericalCoordinates> { std::size_t operator()(const SphericalCoordinates& k) const { // Compute individual hash values for mPhi and mTheta // and combine them using XOR and bit shifting: return ((hash<int>()(k.phi) ^ (hash<int>()(k.theta) << 1))); } }; } double DegreesToRadians(double degrees) { return (degrees/180 * M_PI); } #endif /* LAGER_COMMON_SPHERICAL_COORDINATES_H */
Include what you need as gcc 6 provides less.
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/document/annotation/span.h> #include <vespa/document/serialization/util.h> namespace vespalib { class nbostream; } namespace document { class AlternateSpanList; class Annotation; class FixedTypeRepo; class SpanList; class SpanTree; class SimpleSpanList; class AnnotationDeserializer { public: AnnotationDeserializer(const FixedTypeRepo &repo, vespalib::nbostream &stream, uint16_t version); std::unique_ptr<SpanTree> readSpanTree(); std::unique_ptr<SpanNode> readSpanNode(); // returns 0 if the annotation type is unknown. std::unique_ptr<AlternateSpanList> readAlternateSpanList(); void readAnnotation(Annotation & annotation); private: std::unique_ptr<SpanList> readSpanList(); std::unique_ptr<SimpleSpanList> readSimpleSpanList(); void readSpan(Span & span) { span.from(getInt1_2_4Bytes(_stream)); span.length(getInt1_2_4Bytes(_stream)); } const FixedTypeRepo &_repo; vespalib::nbostream &_stream; uint16_t _version; std::vector<SpanNode *> _nodes; }; } // namespace document
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/document/annotation/span.h> #include <vespa/document/serialization/util.h> #include <vector> namespace vespalib { class nbostream; } namespace document { class AlternateSpanList; class Annotation; class FixedTypeRepo; class SpanList; class SpanTree; class SimpleSpanList; class AnnotationDeserializer { public: AnnotationDeserializer(const FixedTypeRepo &repo, vespalib::nbostream &stream, uint16_t version); std::unique_ptr<SpanTree> readSpanTree(); std::unique_ptr<SpanNode> readSpanNode(); // returns 0 if the annotation type is unknown. std::unique_ptr<AlternateSpanList> readAlternateSpanList(); void readAnnotation(Annotation & annotation); private: std::unique_ptr<SpanList> readSpanList(); std::unique_ptr<SimpleSpanList> readSimpleSpanList(); void readSpan(Span & span) { span.from(getInt1_2_4Bytes(_stream)); span.length(getInt1_2_4Bytes(_stream)); } const FixedTypeRepo &_repo; vespalib::nbostream &_stream; uint16_t _version; std::vector<SpanNode *> _nodes; }; } // namespace document
Add a Debug shmemlog tag.
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(CLI) SLTM(SessionOpen) SLTM(SessionClose) SLTM(ClientAddr) SLTM(Request) SLTM(URL) SLTM(Protocol) SLTM(HD_Unknown) SLTM(HD_Lost) #define HTTPH(a, b, c, d, e, f, g) SLTM(b) #include "http_headers.h" #undef HTTPH
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionClose) SLTM(ClientAddr) SLTM(Request) SLTM(URL) SLTM(Protocol) SLTM(HD_Unknown) SLTM(HD_Lost) #define HTTPH(a, b, c, d, e, f, g) SLTM(b) #include "http_headers.h" #undef HTTPH
Fix build under node.js 0.10.0
#ifndef __COMMON_H__ #define __COMMON_H__ #if NODE_VERSION_AT_LEAST(0,11,0) #define __NODE_V0_11__ #endif #endif
#ifndef __COMMON_H__ #define __COMMON_H__ #ifdef NODE_VERSION_AT_LEAST #if NODE_VERSION_AT_LEAST(0,11,0) #define __NODE_V0_11__ #endif #endif #endif
Add thread safe queue class
// Copyright (c) 2017 Shift Devices AG // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef LIBDBB_SAFEQUEUE_H #define LIBDBB_SAFEQUEUE_H #include <stdint.h> #include <stdlib.h> #include <atomic> #include <queue> #include <mutex> #include <condition_variable> // A threadsafe-queue. template <class T> class SafeQueue { public: SafeQueue(void) : q() , m() , c() {} ~SafeQueue(void) {} // Add an element to the queue. size_t size() { std::lock_guard<std::mutex> lock(m); return q.size(); } // Add an element to the queue. void enqueue(T t) { std::lock_guard<std::mutex> lock(m); q.push(t); c.notify_one(); } // Get the "front"-element. // If the queue is empty, wait till a element is avaiable. T dequeue(void) { std::unique_lock<std::mutex> lock(m); while(q.empty()) { // release lock as long as the wait and reaquire it afterwards. c.wait(lock); } T val = q.front(); q.pop(); return val; } private: std::queue<T> q; mutable std::mutex m; std::condition_variable c; }; #endif // LIBDBB_SAFEQUEUE_H
Remove unnecessarily public method from interface
// // NSManagedObject+JSONHelpers.h // // Created by Saul Mora on 6/28/11. // Copyright 2011 Magical Panda Software LLC. All rights reserved. // #import <CoreData/CoreData.h> extern NSString * const kMagicalRecordImportCustomDateFormatKey; extern NSString * const kMagicalRecordImportDefaultDateFormatString; extern NSString * const kMagicalRecordImportUnixTimeString; extern NSString * const kMagicalRecordImportAttributeKeyMapKey; extern NSString * const kMagicalRecordImportAttributeValueClassNameKey; extern NSString * const kMagicalRecordImportRelationshipMapKey; extern NSString * const kMagicalRecordImportRelationshipLinkedByKey; extern NSString * const kMagicalRecordImportRelationshipTypeKey; @interface NSManagedObject (MagicalRecord_DataImport) - (BOOL) MR_importValuesForKeysWithObject:(id)objectData; + (instancetype) MR_importFromObject:(id)data; + (instancetype) MR_importFromObject:(id)data inContext:(NSManagedObjectContext *)context; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context; @end @interface NSManagedObject (MagicalRecord_DataImportControls) - (BOOL) shouldImport:(id)data; - (void) willImport:(id)data; - (void) didImport:(id)data; @end
// // NSManagedObject+JSONHelpers.h // // Created by Saul Mora on 6/28/11. // Copyright 2011 Magical Panda Software LLC. All rights reserved. // #import <CoreData/CoreData.h> extern NSString * const kMagicalRecordImportCustomDateFormatKey; extern NSString * const kMagicalRecordImportDefaultDateFormatString; extern NSString * const kMagicalRecordImportUnixTimeString; extern NSString * const kMagicalRecordImportAttributeKeyMapKey; extern NSString * const kMagicalRecordImportAttributeValueClassNameKey; extern NSString * const kMagicalRecordImportRelationshipMapKey; extern NSString * const kMagicalRecordImportRelationshipLinkedByKey; extern NSString * const kMagicalRecordImportRelationshipTypeKey; @interface NSManagedObject (MagicalRecord_DataImport) + (instancetype) MR_importFromObject:(id)data; + (instancetype) MR_importFromObject:(id)data inContext:(NSManagedObjectContext *)context; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData; + (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context; @end @interface NSManagedObject (MagicalRecord_DataImportControls) - (BOOL) shouldImport:(id)data; - (void) willImport:(id)data; - (void) didImport:(id)data; @end
Replace strchr() condition with TrimSuffixC().
#include <h/mh.h> const char * read_line(void) { char *cp; static char line[BUFSIZ]; fflush(stdout); if (fgets(line, sizeof(line), stdin) == NULL) return NULL; if ((cp = strchr(line, '\n'))) *cp = 0; return line; }
#include <h/mh.h> #include <h/utils.h> const char * read_line(void) { static char line[BUFSIZ]; fflush(stdout); if (fgets(line, sizeof(line), stdin) == NULL) return NULL; TrimSuffixC(line, '\n'); return line; /* May not be a complete line. */ }
Fix compilation issue on arm64 with Debian's glibc 2.19
// Copyright 2018 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_ #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_ #include_next <sys/user.h> #include <features.h> // glibc for 64-bit ARM uses different names for these structs prior to 2.20. #if defined(__aarch64__) && defined(__GLIBC__) #if !__GLIBC_PREREQ(2, 20) using user_regs_struct = user_pt_regs; using user_fpsimd_struct = user_fpsimd_state; #endif #endif #endif // CRASHPAD_COMPAT_LINUX_SYS_USER_H_
// Copyright 2018 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_ #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_ #include_next <sys/user.h> #include <features.h> // glibc for 64-bit ARM uses different names for these structs prior to 2.20. // However, Debian's glibc 2.19-8 backported the change so it's not sufficient // to only test the version. user_pt_regs and user_fpsimd_state are actually // defined in <asm/ptrace.h> so we use the include guard here. #if defined(__aarch64__) && defined(__GLIBC__) #if !__GLIBC_PREREQ(2, 20) && defined(__ASM_PTRACE_H) using user_regs_struct = user_pt_regs; using user_fpsimd_struct = user_fpsimd_state; #endif #endif #endif // CRASHPAD_COMPAT_LINUX_SYS_USER_H_
Add test case on struct initialization and assignment
/* From Listing 3 in "Test-Case Reduction for C Compiler Bugs" paper, avaiable * at http://www.cs.utah.edu/~regehr/papers/pldi12-preprint.pdf. */ int printf (const char *, ...); struct { int f0; int f1; int f2; } a, b = { 0, 0, 1 }; void fn1 () { a = b; a = a; } int main () { fn1 (); printf ("%d\n", a.f2); return 0; }
Add IR sensor debugging program, using robotc API
#pragma config(Sensor, S1, ir, sensorHiTechnicIRSeeker600) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// task main() { while (true) { nxtDisplayTextLine(0, "S:%d", SensorValue[ir]); nxtDisplayTextLine(1, "R:%d", SensorRaw[ir]); } }
Add a noop for upgrade so we don't get the warning.
#include <erl_nif.h> static ERL_NIF_TERM kinit(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { return enif_make_atom(env, "true"); } static ErlNifFunc nif_funcs[] = { {"kinit", 2, kinit} }; ERL_NIF_INIT(kinit, nif_funcs, NULL, NULL, NULL, NULL)
#include <erl_nif.h> static ERL_NIF_TERM kinit(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { return enif_make_atom(env, "true"); } int noop(ErlNifEnv* env, void** priv_data, void** old_priv_data, ERL_NIF_TERM load_info) { return 0; } static ErlNifFunc nif_funcs[] = { {"kinit", 2, kinit} }; ERL_NIF_INIT(kinit, nif_funcs, NULL, NULL, noop, NULL)
Move some globals to globals.h.
#include <stdio.h> extern int print_is_on; double m_open(float *, short, double *); double m_input(float *p,short n_args,double *pp) { p[1] = (n_args > 1) ? p[1] : 0.; p[2] = 0; n_args = 3; if(print_is_on) fprintf(stderr,"Opening input file as unit %d\n",(int)p[1]); return m_open(p,n_args,pp); } double m_output(float *p,short n_args,double *pp) { int i; p[1] = (n_args > 1) ? p[1] : 1.; p[2] = 2; n_args = 3; i = p[0]; if(print_is_on) fprintf(stderr,"Opening output file as unit %d\n",(int)p[1]); return m_open(p,n_args,pp); }
#include <globals.h> #include <stdio.h> extern double m_open(float *, short, double *); double m_input(float *p,short n_args,double *pp) { p[1] = (n_args > 1) ? p[1] : 0.; p[2] = 0; n_args = 3; if(print_is_on) fprintf(stderr,"Opening input file as unit %d\n",(int)p[1]); return m_open(p,n_args,pp); } double m_output(float *p,short n_args,double *pp) { int i; p[1] = (n_args > 1) ? p[1] : 1.; p[2] = 2; n_args = 3; i = p[0]; if(print_is_on) fprintf(stderr,"Opening output file as unit %d\n",(int)p[1]); return m_open(p,n_args,pp); }
Add Qadeer record init example
typedef struct list { struct list *next; struct list *prev; } list_t; typedef struct record { int data1; list_t node; int data2; } record_t; #define container(p) ((record_t*)((int*)(p) - 1)) void init_record(list_t *p) { record_t *r = container(p); r->data2 = 42; } void init_all_records(list_t *p) { while (p != NULL) { init_record(p); p = p->next; } }
Add a space to the terminating array entry
#include "flags.h" #include <stdio.h> #include "laco.h" #include "util.h" static const char* version_matches[] = {"-v", "--version", NULL}; static const char* help_matches[] = {"-h", "-?", "--help", NULL}; /* Print off the current version of laco */ static void handle_version(LacoState* laco, const char** arguments) { const char* version = laco_get_laco_version(laco); printf("laco version %s\n", version); laco_kill(laco, 0, NULL); } /* Print off the help screen */ static void handle_help(LacoState* laco, const char** arguments) { puts("A better REPL for Lua.\n"); puts("Usage: laco [options]\n"); puts("-h | -? | --help \tPrint this help screen"); puts("-v | --version \tPrint current version"); laco_kill(laco, 0, NULL); } static const struct LacoCommand flag_commands[] = { { version_matches, handle_version }, { help_matches, handle_help }, { NULL, NULL} }; /* External API */ void laco_handle_flag(LacoState* laco) { const char* command = laco_get_laco_args(laco)[1]; laco_dispatch(flag_commands, laco, command, NULL); }
#include "flags.h" #include <stdio.h> #include "laco.h" #include "util.h" static const char* version_matches[] = {"-v", "--version", NULL}; static const char* help_matches[] = {"-h", "-?", "--help", NULL}; /* Print off the current version of laco */ static void handle_version(LacoState* laco, const char** arguments) { const char* version = laco_get_laco_version(laco); printf("laco version %s\n", version); laco_kill(laco, 0, NULL); } /* Print off the help screen */ static void handle_help(LacoState* laco, const char** arguments) { puts("A better REPL for Lua.\n"); puts("Usage: laco [options]\n"); puts("-h | -? | --help \tPrint this help screen"); puts("-v | --version \tPrint current version"); laco_kill(laco, 0, NULL); } static const struct LacoCommand flag_commands[] = { { version_matches, handle_version }, { help_matches, handle_help }, { NULL, NULL } }; /* External API */ void laco_handle_flag(LacoState* laco) { const char* command = laco_get_laco_args(laco)[1]; laco_dispatch(flag_commands, laco, command, NULL); }
Make serr and sout mutable to use them in const methods
/** * log.h - Header of log class * includes 2 methods to show warrnings and errors * @author Pavel Kryukov * Copyright 2017 MIPT-MIPS team */ #ifndef LOG_H #define LOG_H #include <iostream> #include <ostream> class LogOstream { const bool enable; std::ostream& stream; public: struct Critical { }; LogOstream(bool value, std::ostream& _out) : enable(value), stream(_out) { } friend LogOstream& operator<<(LogOstream&, const Critical&) { exit(-1); } LogOstream& operator<<(std::ostream& (*F)(std::ostream&)) { if ( enable) F(stream); return *this; } template<typename T> LogOstream& operator<<(const T& v) { if ( enable) { stream << v; } return *this; } }; class Log { public: LogOstream sout; LogOstream serr; LogOstream::Critical critical; Log(bool value) : sout(value, std::cout), serr(true, std::cerr), critical() { } virtual ~Log() { } }; #endif /* LOG_H */
/** * log.h - Header of log class * includes 2 methods to show warrnings and errors * @author Pavel Kryukov * Copyright 2017 MIPT-MIPS team */ #ifndef LOG_H #define LOG_H #include <iostream> #include <ostream> class LogOstream { const bool enable; std::ostream& stream; public: struct Critical { }; LogOstream(bool value, std::ostream& _out) : enable(value), stream(_out) { } friend LogOstream& operator<<(LogOstream&, const Critical&) { exit(-1); } LogOstream& operator<<(std::ostream& (*F)(std::ostream&)) { if ( enable) F(stream); return *this; } template<typename T> LogOstream& operator<<(const T& v) { if ( enable) { stream << v; } return *this; } }; class Log { public: mutable LogOstream sout; mutable LogOstream serr; const LogOstream::Critical critical; Log(bool value) : sout(value, std::cout), serr(true, std::cerr), critical() { } virtual ~Log() { } }; #endif /* LOG_H */
Add hello world C example
/******************************************************************************* * File : hw.c * Author : Sandeep Koranne * * Purpose : Hello, World in C * ******************************************************************************/ #include <stdio.h> #include <stdlib.h> int main() { printf("Hello, World!\n"); return ( EXIT_SUCCESS ); }
Switch to importing framework header
// // MRHexKeyboard.h // // Created by Mikk Rätsep on 02/10/13. // Copyright (c) 2013 Mikk Rätsep. All rights reserved. // @import UIKit; @interface MRHexKeyboard : UIView <UITextFieldDelegate> @property(nonatomic, assign) CGFloat height; @property(nonatomic, assign) BOOL display0xButton; @property(nonatomic, assign) BOOL add0x; @end
// // MRHexKeyboard.h // // Created by Mikk Rätsep on 02/10/13. // Copyright (c) 2013 Mikk Rätsep. All rights reserved. // #import <UIKit/UIKit.h> @interface MRHexKeyboard : UIView <UITextFieldDelegate> @property(nonatomic, assign) CGFloat height; @property(nonatomic, assign) BOOL display0xButton; @property(nonatomic, assign) BOOL add0x; @end
Revert "util: Always specify default visibility on exports."
// // Copyright 2018 The ANGLE 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. // // util_export.h : Defines ANGLE_UTIL_EXPORT, a macro for exporting symbols. #ifndef UTIL_EXPORT_H_ #define UTIL_EXPORT_H_ #if !defined(ANGLE_UTIL_EXPORT) # if defined(_WIN32) # if defined(LIBANGLE_UTIL_IMPLEMENTATION) # define ANGLE_UTIL_EXPORT __declspec(dllexport) # else # define ANGLE_UTIL_EXPORT __declspec(dllimport) # endif # elif defined(__GNUC__) # define ANGLE_UTIL_EXPORT __attribute__((visibility("default"))) # else # define ANGLE_UTIL_EXPORT # endif #endif // !defined(ANGLE_UTIL_EXPORT) #endif // UTIL_EXPORT_H_
// // Copyright 2018 The ANGLE 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. // // util_export.h : Defines ANGLE_UTIL_EXPORT, a macro for exporting symbols. #ifndef UTIL_EXPORT_H_ #define UTIL_EXPORT_H_ #if !defined(ANGLE_UTIL_EXPORT) # if defined(_WIN32) # if defined(LIBANGLE_UTIL_IMPLEMENTATION) # define ANGLE_UTIL_EXPORT __declspec(dllexport) # else # define ANGLE_UTIL_EXPORT __declspec(dllimport) # endif # elif defined(__GNUC__) # if defined(LIBANGLE_UTIL_IMPLEMENTATION) # define ANGLE_UTIL_EXPORT __attribute__((visibility("default"))) # else # define ANGLE_UTIL_EXPORT # endif # else # define ANGLE_UTIL_EXPORT # endif #endif // !defined(ANGLE_UTIL_EXPORT) #endif // UTIL_EXPORT_H_
Add some sceAVConfig volume functions
/** * \usergroup{SceAVConfig} * \usage{psp2/avconfig.h,SceAVConfig_stub} */ #ifndef _PSP2_AVCONFIG_H_ #define _PSP2_AVCONFIG_H_ #include <psp2/types.h> #ifdef __cplusplus extern "C" { #endif /*** * Get the maximum brightness. * * @param[out] maxBrightness - Maximum brightness. * * @return 0 on success, < 0 on error. */ int sceAVConfigGetDisplayMaxBrightness(int *maxBrightness); /*** * Set the screen brightness. * * @param brightness - Brightness that the screen will be set to (range 21-65536, 0 turns off the screen). * * @return 0 on success, < 0 on error. */ int sceAVConfigSetDisplayBrightness(int brightness); #ifdef __cplusplus } #endif #endif
/** * \usergroup{SceAVConfig} * \usage{psp2/avconfig.h,SceAVConfig_stub} */ #ifndef _PSP2_AVCONFIG_H_ #define _PSP2_AVCONFIG_H_ #include <psp2/types.h> #ifdef __cplusplus extern "C" { #endif /*** * Get the maximum brightness. * * @param[out] maxBrightness - Maximum brightness. * * @return 0 on success, < 0 on error. */ int sceAVConfigGetDisplayMaxBrightness(int *maxBrightness); /*** * Set the screen brightness. * * @param brightness - Brightness that the screen will be set to (range 21-65536, 0 turns off the screen). * * @return 0 on success, < 0 on error. */ int sceAVConfigSetDisplayBrightness(int brightness); /*** * Get the shutter volume. * * @param[out] volume - shutter volume. * * @return 0 on success, < 0 on error. */ int sceAVConfigGetShutterVol(int *volume); /*** * Get the system volume. * * @param[out] volume - System volume. * * @return 0 on success, < 0 on error. */ int sceAVConfigGetSystemVol(int *volume); /*** * Set the system volume. * * @param volume - volume that the device will be set to (range 0-30). * * @return 0 on success, < 0 on error. */ int sceAVConfigSetSystemVol(int volume); /** * Turns on mute. * * @return 0 on success, < 0 on error. * */ int sceAVConfigMuteOn(void); #ifdef __cplusplus } #endif #endif
Fix typo phsyical => physical
//===--- CallingConvention.h - Calling conventions --------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file declares the interfaces for working with abstract and // phsyical calling conventions. // //===----------------------------------------------------------------------===// #ifndef SWIFT_IRGEN_CALLINGCONVENTION_H #define SWIFT_IRGEN_CALLINGCONVENTION_H #include "llvm/IR/CallingConv.h" namespace llvm { class AttributeSet; class Value; } namespace swift { class ValueDecl; enum class SILFunctionTypeRepresentation : uint8_t; namespace irgen { class IRGenModule; /// Expand an abstract SIL function type representation into a physical /// convention. llvm::CallingConv::ID expandCallingConv(IRGenModule &IGM, SILFunctionTypeRepresentation convention); } // end namespace irgen } // end namespace swift #endif
//===--- CallingConvention.h - Calling conventions --------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file declares the interfaces for working with abstract and // physical calling conventions. // //===----------------------------------------------------------------------===// #ifndef SWIFT_IRGEN_CALLINGCONVENTION_H #define SWIFT_IRGEN_CALLINGCONVENTION_H #include "llvm/IR/CallingConv.h" namespace llvm { class AttributeSet; class Value; } namespace swift { class ValueDecl; enum class SILFunctionTypeRepresentation : uint8_t; namespace irgen { class IRGenModule; /// Expand an abstract SIL function type representation into a physical /// convention. llvm::CallingConv::ID expandCallingConv(IRGenModule &IGM, SILFunctionTypeRepresentation convention); } // end namespace irgen } // end namespace swift #endif