Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Fix the Vale build onx 64 Linux by definining empty calling convention keywords
#ifndef __GCC_COMPAT_H #define __GCC_COMPAT_H #ifdef __GNUC__ // gcc does not support the __cdecl, __stdcall or __fastcall notation // except on Windows #ifndef _WIN32 #define __cdecl __attribute__((cdecl)) #define __stdcall __attribute__((stdcall)) #define __fastcall __attribute__((fastcall)) #endif // ! _WIN32 #endif // __GNUC__ #endif // __GCC_COMPAT_H
#ifndef __GCC_COMPAT_H #define __GCC_COMPAT_H #ifdef __GNUC__ // gcc does not support the __cdecl, __stdcall or __fastcall notation // except on Windows #ifdef _WIN32 #define __cdecl __attribute__((cdecl)) #define __stdcall __attribute__((stdcall)) #define __fastcall __attribute__((fastcall)) #else #define __cdecl #define __stdcall #define __fastcall #endif // _WIN32 #endif // __GNUC__ #endif // __GCC_COMPAT_H
Add SVC function IDs for Management Mode.
/** @file * * Copyright (c) 2012-2017, ARM Limited. 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 __ARM_MM_SVC_H__ #define __ARM_MM_SVC_H__ /* * SVC IDs to allow the MM secure partition to initialise itself, handle * delegated events and request the Secure partition manager to perform * privileged operations on its behalf. */ #define ARM_SVC_ID_SPM_VERSION_AARCH64 0xC4000060 #define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 0xC4000061 #define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64 0xC4000064 #define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64 0xC4000065 #define SET_MEM_ATTR_DATA_PERM_MASK 0x3 #define SET_MEM_ATTR_DATA_PERM_SHIFT 0 #define SET_MEM_ATTR_DATA_PERM_NO_ACCESS 0 #define SET_MEM_ATTR_DATA_PERM_RW 1 #define SET_MEM_ATTR_DATA_PERM_RO 3 #define SET_MEM_ATTR_CODE_PERM_MASK 0x1 #define SET_MEM_ATTR_CODE_PERM_SHIFT 2 #define SET_MEM_ATTR_CODE_PERM_X 0 #define SET_MEM_ATTR_CODE_PERM_XN 1 #define SET_MEM_ATTR_MAKE_PERM_REQUEST(d_perm, c_perm) \ ((((c_perm) & SET_MEM_ATTR_CODE_PERM_MASK) << SET_MEM_ATTR_CODE_PERM_SHIFT) | \ (( (d_perm) & SET_MEM_ATTR_DATA_PERM_MASK) << SET_MEM_ATTR_DATA_PERM_SHIFT)) #endif
Modify old-style derived GFE_BUG macros to have IDs.
// Copyright (c) 2019 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 QUICHE_SPDY_PLATFORM_API_SPDY_BUG_TRACKER_H_ #define QUICHE_SPDY_PLATFORM_API_SPDY_BUG_TRACKER_H_ #include "net/spdy/platform/impl/spdy_bug_tracker_impl.h" #define SPDY_BUG SPDY_BUG_IMPL #define SPDY_BUG_IF(condition) SPDY_BUG_IF_IMPL(condition) // V2 macros are the same as all the SPDY_BUG flavor above, but they take a // bug_id parameter. #define SPDY_BUG_V2 SPDY_BUG_V2_IMPL #define SPDY_BUG_IF_V2 SPDY_BUG_IF_V2_IMPL #define FLAGS_spdy_always_log_bugs_for_tests \ FLAGS_spdy_always_log_bugs_for_tests_impl #endif // QUICHE_SPDY_PLATFORM_API_SPDY_BUG_TRACKER_H_
// Copyright (c) 2019 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 QUICHE_SPDY_PLATFORM_API_SPDY_BUG_TRACKER_H_ #define QUICHE_SPDY_PLATFORM_API_SPDY_BUG_TRACKER_H_ #include "net/spdy/platform/impl/spdy_bug_tracker_impl.h" #define SPDY_BUG SPDY_BUG_IMPL #define SPDY_BUG_IF(bug_id, condition) SPDY_BUG_IF_IMPL(bug_id, condition) // V2 macros are the same as all the SPDY_BUG flavor above, but they take a // bug_id parameter. #define SPDY_BUG_V2 SPDY_BUG_V2_IMPL #define SPDY_BUG_IF_V2 SPDY_BUG_IF_V2_IMPL #define FLAGS_spdy_always_log_bugs_for_tests \ FLAGS_spdy_always_log_bugs_for_tests_impl #endif // QUICHE_SPDY_PLATFORM_API_SPDY_BUG_TRACKER_H_
Update 1012 (Fix a typo)
/* https://www.urionlinejudge.com.br/judge/en/problems/view/1012 */ #include <stdio.h> int main(){ const double PI = 3.14159; double a, b, c; scanf("%lf %lf %lf", &a, &b, &c); /* the area of the rectangled triangle that has base A and height C A = (base * height) / 2 */ printf("TRIANGULO = %.3lf\n", (a*c)/2); /* the area of the radius's circle C. (pi = 3.14159) A = PI * radius */ printf("CIRCULO = %.3lf\n", PI*c*c); /* the area of the trapezium which has A and B by base, and C by height A = ((larger base + minor base) * height) / 2 */ printf("TRAPEZIO = %.3lf\n", ((a+b)*c)/2); /* the area of ​​the square that has side B A = side^2 */ printf("QUADRADO = %.3lf\n", b*b); /* the area of the rectangle that has sides A and B A = base * height */ printf("RETANGULO = %.3lf\n", a*b); return 0; }
/* https://www.urionlinejudge.com.br/judge/en/problems/view/1012 */ #include <stdio.h> int main(){ const double PI = 3.14159; double a, b, c; scanf("%lf %lf %lf", &a, &b, &c); /* the area of the rectangled triangle that has base A and height C A = (base * height) / 2 */ printf("TRIANGULO: %.3lf\n", (a*c)/2); /* the area of the radius's circle C. (pi = 3.14159) A = PI * radius */ printf("CIRCULO: %.3lf\n", PI*c*c); /* the area of the trapezium which has A and B by base, and C by height A = ((larger base + minor base) * height) / 2 */ printf("TRAPEZIO: %.3lf\n", ((a+b)*c)/2); /* the area of ​​the square that has side B A = side^2 */ printf("QUADRADO: %.3lf\n", b*b); /* the area of the rectangle that has sides A and B A = base * height */ printf("RETANGULO: %.3lf\n", a*b); return 0; }
Add source code documentation for the RocksDB Plain Table Options class
// // RocksDBPlainTableOptions.h // ObjectiveRocks // // Created by Iska on 04/01/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> typedef NS_ENUM(char, PlainTableEncodingType) { PlainTableEncodingPlain, PlainTableEncodingPrefix }; @interface RocksDBPlainTableOptions : NSObject @property (nonatomic, assign) uint32_t userKeyLen; @property (nonatomic, assign) int bloomBitsPerKey; @property (nonatomic, assign) double hashTableRatio; @property (nonatomic, assign) size_t indexSparseness; @property (nonatomic, assign) size_t hugePageTlbSize; @property (nonatomic, assign) PlainTableEncodingType encodingType; @property (nonatomic, assign) BOOL fullScanMode; @property (nonatomic, assign) BOOL storeIndexInFile; @end
// // RocksDBPlainTableOptions.h // ObjectiveRocks // // Created by Iska on 04/01/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> typedef NS_ENUM(char, PlainTableEncodingType) { PlainTableEncodingPlain, PlainTableEncodingPrefix }; @interface RocksDBPlainTableOptions : NSObject /** @brief Plain table has optimization for fix-sized keys, which can be specified via userKeyLen. */ @property (nonatomic, assign) uint32_t userKeyLen; /** @brief The number of bits used for bloom filer per prefix. To disable it pass a zero. */ @property (nonatomic, assign) int bloomBitsPerKey; /** @brief The desired utilization of the hash table used for prefix hashing. `hashTableRatio` = number of prefixes / #buckets in the hash table. */ @property (nonatomic, assign) double hashTableRatio; /** @brief Used to build one index record inside each prefix for the number of keys for the binary search inside each hash bucket. */ @property (nonatomic, assign) size_t indexSparseness; /** @brief Huge page TLB size. The user needs to reserve huge pages for it to be allocated, like: `sysctl -w vm.nr_hugepages=20` */ @property (nonatomic, assign) size_t hugePageTlbSize; /** @brief Encoding type for the keys. The value will determine how to encode keys when writing to a new SST file. */ @property (nonatomic, assign) PlainTableEncodingType encodingType; /** @brief Mode for reading the whole file one record by one without using the index. */ @property (nonatomic, assign) BOOL fullScanMode; /** @brief Compute plain table index and bloom filter during file building and store it in file. When reading file, index will be mmaped instead of recomputation. */ @property (nonatomic, assign) BOOL storeIndexInFile; @end
Add -fsyntax-only to fix failure in read-only directories.
// REQUIRES: x86-registered-target // RUN: %clang -target i386-pc-elfiamcu -c -v %s 2>&1 | FileCheck %s // CHECK-NOT: /usr/include // CHECK-NOT: /usr/local/include
// REQUIRES: x86-registered-target // RUN: %clang -target i386-pc-elfiamcu -c -v -fsyntax-only %s 2>&1 | FileCheck %s // CHECK-NOT: /usr/include // CHECK-NOT: /usr/local/include
Return an adress of Window object.
// mruby libraries #include "mruby.h" #include "mruby/array.h" #include "mruby/data.h" #include "mruby/string.h" #include <X11/Xlib.h> mrb_value x11_simple_test(mrb_state* mrb, mrb_value self) { Display *dpy = XOpenDisplay(NULL); Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 256, 256, 0, 0, 0); XMapWindow(dpy, win); XFlush(dpy); while(1); return mrb_nil_value(); } // initializer void mrb_mruby_x11_simple_gem_init(mrb_state* mrb) { struct RClass* rclass = mrb_define_module(mrb, "X11"); mrb_define_class_method(mrb, rclass, "test", x11_simple_test, ARGS_NONE()); return; } // finalizer void mrb_mruby_x11_simple_gem_final(mrb_state* mrb) { return; }
// mruby libraries #include "mruby.h" #include "mruby/array.h" #include "mruby/data.h" #include "mruby/string.h" #include <X11/Xlib.h> mrb_value x11_simple_test(mrb_state* mrb, mrb_value self) { Display* dpy = XOpenDisplay(NULL); Window* win = mrb_malloc(mrb, sizeof(Window)); *win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 256, 256, 0, 0, 0); XMapWindow(dpy, *win); XFlush(dpy); return mrb_fixnum_value((int)win); } // initializer void mrb_mruby_x11_simple_gem_init(mrb_state* mrb) { struct RClass* rclass = mrb_define_module(mrb, "X11"); mrb_define_class_method(mrb, rclass, "test", x11_simple_test, ARGS_NONE()); return; } // finalizer void mrb_mruby_x11_simple_gem_final(mrb_state* mrb) { return; }
Fix compilation with namespaced Qt.
#ifndef QMLWARNINGDIALOG_H #define QMLWARNINGDIALOG_H #include <QDialog> namespace Ui { class QmlWarningDialog; } namespace QmlDesigner { namespace Internal { class QmlWarningDialog : public QDialog { Q_OBJECT public: explicit QmlWarningDialog(QWidget *parent, const QStringList &warnings); ~QmlWarningDialog(); bool warningsEnabled() const; public slots: void ignoreButtonPressed(); void okButtonPressed(); void checkBoxToggled(bool); void linkClicked(const QString &link); private: Ui::QmlWarningDialog *ui; const QStringList m_warnings; }; } //Internal } //QmlDesigner #endif // QMLWARNINGDIALOG_H
#ifndef QMLWARNINGDIALOG_H #define QMLWARNINGDIALOG_H #include <QDialog> QT_BEGIN_NAMESPACE namespace Ui { class QmlWarningDialog; } QT_END_NAMESPACE namespace QmlDesigner { namespace Internal { class QmlWarningDialog : public QDialog { Q_OBJECT public: explicit QmlWarningDialog(QWidget *parent, const QStringList &warnings); ~QmlWarningDialog(); bool warningsEnabled() const; public slots: void ignoreButtonPressed(); void okButtonPressed(); void checkBoxToggled(bool); void linkClicked(const QString &link); private: Ui::QmlWarningDialog *ui; const QStringList m_warnings; }; } //Internal } //QmlDesigner #endif // QMLWARNINGDIALOG_H
Add a convenience template for private pointers.
/* * This file is part of the Gluon Development Platform * Copyright (c) 2014 Arjen Hiemstra <ahiemstra@heimr.nl> * * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef GLUONCORE_PRIVATEPOINTER_H #define GLUONCORE_PRIVATEPOINTER_H #include <memory> namespace GluonCore { template < typename T > class PrivatePointer { public: PrivatePointer() : p{ new T{} } { } template < typename... Args > explicit PrivatePointer( Args&& ... args ) : p{ std::forward< Args >( args ) ... } { } PrivatePointer( const PrivatePointer< T >&& other ) { p = other.p; } PrivatePointer< T >& operator=( const PrivatePointer< T >&& other ) { p = other.p; return *this; } inline const T* operator->() const { return p.get(); } inline T* operator->() { return p.get(); } private: std::unique_ptr< T > p; }; } #define GLUON_PRIVATE_POINTER \ private:\ class Private;\ GluonCore::PrivatePointer< Private > d; #endif //GLUONCORE_PRIVATEPOINTER_H
Build skeleton for nRF frames
#include <systick.h> #include <protocol_hk310.h> #define FRAME_TIME 5 // 1 frame every 5 ms // **************************************************************************** static void protocol_frame_callback(void) { systick_set_callback(protocol_frame_callback, FRAME_TIME); } // **************************************************************************** void init_protocol_hk310(void) { systick_set_callback(protocol_frame_callback, FRAME_TIME); }
#include <systick.h> #include <protocol_hk310.h> #define FRAME_TIME 5 // One frame every 5 ms typedef enum { SEND_STICK1 = 0, SEND_STICK2, SEND_BIND_INFO, SEND_PROGRAMBOX } frame_state_t; static frame_state_t frame_state; // **************************************************************************** static void send_stick_data(void) { } // **************************************************************************** static void send_binding_data(void) { } // **************************************************************************** static void send_programming_box_data(void) { } // **************************************************************************** static void nrf_transmit_done_callback(void) { switch (frame_state) { case SEND_STICK1: send_stick_data(); frame_state = SEND_BIND_INFO; break; case SEND_STICK2: send_stick_data(); frame_state = SEND_BIND_INFO; break; case SEND_BIND_INFO: send_binding_data(); frame_state = SEND_PROGRAMBOX; break; case SEND_PROGRAMBOX: send_programming_box_data(); frame_state = SEND_STICK1; break; default: break; } } // **************************************************************************** static void protocol_frame_callback(void) { systick_set_callback(protocol_frame_callback, FRAME_TIME); frame_state = SEND_STICK1; nrf_transmit_done_callback(); } // **************************************************************************** void init_protocol_hk310(void) { systick_set_callback(protocol_frame_callback, FRAME_TIME); }
Use noexcept insead of throw() for what()
#ifndef _WALKEREXCEPTION_H #define _WALKEREXCEPTION_H #include <string> //! (base) class for exceptions in uvok/WikiWalker class WalkerException : public std::exception { public: /*! Create a Walker exception with a message. * * Message might be shown on exception occurring, depending on * the compiler. * * \param exmessage The exception message. */ WalkerException(std::string exmessage) : message(exmessage) {} virtual ~WalkerException() throw() {} //! get exception message const char* what() const throw() { return message.c_str(); } private: std::string message; }; #endif // _WALKEREXCEPTION_H
#ifndef _WALKEREXCEPTION_H #define _WALKEREXCEPTION_H #include <string> //! (base) class for exceptions in uvok/WikiWalker class WalkerException : public std::exception { public: /*! Create a Walker exception with a message. * * Message might be shown on exception occurring, depending on * the compiler. * * \param exmessage The exception message. */ WalkerException(std::string exmessage) : message(exmessage) {} virtual ~WalkerException() throw() {} //! get exception message const char* what() const noexcept { return message.c_str(); } private: std::string message; }; #endif // _WALKEREXCEPTION_H
Fix the build by updating FRIEND_TEST line.
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_H_ #define CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_H_ #include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest_prod.h" class Browser; class FilePath; namespace IPC { class Message; } class PrintDialogCloud { public: // Called on the IO thread. static void CreatePrintDialogForPdf(const FilePath& path_to_pdf); private: FRIEND_TEST(PrintDialogCloudTest, HandlersRegistered); explicit PrintDialogCloud(const FilePath& path_to_pdf); ~PrintDialogCloud(); // Called as a task from the UI thread, creates an object instance // to run the HTML/JS based print dialog for printing through the cloud. static void CreateDialogImpl(const FilePath& path_to_pdf); Browser* browser_; DISALLOW_COPY_AND_ASSIGN(PrintDialogCloud); }; #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_H_ #define CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_H_ #include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest_prod.h" class Browser; class FilePath; namespace IPC { class Message; } class PrintDialogCloud { public: // Called on the IO thread. static void CreatePrintDialogForPdf(const FilePath& path_to_pdf); private: FRIEND_TEST(PrintDialogCloudTest, HandlersRegistered); FRIEND_TEST(PrintDialogCloudTest, DISABLED_HandlersRegistered); explicit PrintDialogCloud(const FilePath& path_to_pdf); ~PrintDialogCloud(); // Called as a task from the UI thread, creates an object instance // to run the HTML/JS based print dialog for printing through the cloud. static void CreateDialogImpl(const FilePath& path_to_pdf); Browser* browser_; DISALLOW_COPY_AND_ASSIGN(PrintDialogCloud); }; #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_CLOUD_H_
Solve Time Conversion in c
#include <stdio.h> int main() { int t, h = 0, m = 0; while (scanf("%d", &t) != EOF) { if (t >= 60 * 60) { h = t / (60 * 60); t %= (60 * 60); } if (t >= 60) { m = t / 60; t %= 60; } printf("%d:%d:%d\n", h, m, t); h = 0, m = 0; } return 0; }
Add std:: namespace to int types
// Raster Library // Copyright (C) 2015 David Capello #ifndef RASTER_BUFFER_VIEW_INCLUDED_H #define RASTER_BUFFER_VIEW_INCLUDED_H #pragma once #include <cassert> #include <cstdint> #include <vector> #include "raster/image_spec.h" namespace raster { // Wrapper for an array of bytes. It doesn't own the data. class buffer_view { public: typedef uint8_t value_type; typedef value_type* pointer; typedef value_type& reference; buffer_view(size_t size, pointer data) : m_size(size) , m_data(data) { } template<typename T> buffer_view(std::vector<T>& vector) : m_size(vector.size()) , m_data(&vector[0]) { } size_t size() const { return m_size; } pointer begin() { return m_data; } pointer end() { return m_data+m_size; } const pointer begin() const { return m_data; } const pointer end() const { return m_data+m_size; } reference operator[](int i) const { assert(i >= 0 && i < int(m_size)); return m_data[i]; } private: size_t m_size; pointer m_data; }; } // namespace raster #endif
// Raster Library // Copyright (C) 2015-2016 David Capello #ifndef RASTER_BUFFER_VIEW_INCLUDED_H #define RASTER_BUFFER_VIEW_INCLUDED_H #pragma once #include <cassert> #include <cstddef> #include <cstdint> #include <vector> #include "raster/image_spec.h" namespace raster { // Wrapper for an array of bytes. It doesn't own the data. class buffer_view { public: typedef std::uint8_t value_type; typedef value_type* pointer; typedef value_type& reference; buffer_view(std::size_t size, pointer data) : m_size(size) , m_data(data) { } template<typename T> buffer_view(std::vector<T>& vector) : m_size(vector.size()) , m_data(&vector[0]) { } std::size_t size() const { return m_size; } pointer begin() { return m_data; } pointer end() { return m_data+m_size; } const pointer begin() const { return m_data; } const pointer end() const { return m_data+m_size; } reference operator[](int i) const { assert(i >= 0 && i < int(m_size)); return m_data[i]; } private: size_t m_size; pointer m_data; }; } // namespace raster #endif
Add logic to this behavior
/* * GoBackward.h * * Created on: Mar 25, 2014 * Author: user */ #ifndef GOBACKWARD_H_ #define GOBACKWARD_H_ #include "Behavior.h" #include "../Robot.h" class GoBackward: public Behavior { public: GoBackward(Robot* robot); bool startCondition(); bool stopCondition(); void action(); virtual ~GoBackward(); }; #endif /* GOBACKWARD_H_ */
/* * GoBackward.h * * Created on: Mar 25, 2014 * Author: user */ #ifndef GOBACKWARD_H_ #define GOBACKWARD_H_ #include "Behavior.h" #include "../Robot.h" class GoBackward: public Behavior { public: GoBackward(Robot* robot); bool startCondition(); bool stopCondition(); void action(); virtual ~GoBackward(); private: int _steps_count; }; #endif /* GOBACKWARD_H_ */
Remove them. Deal with them later if perf is actually an issue here.
#ifndef CC_ANALYSIS_ANALYSIS_OPTIONS_H_ #define CC_ANALYSIS_ANALYSIS_OPTIONS_H_ #include <cstddef> struct AnalysisOptions { AnalysisOptions() : track_index_translation(true), destutter_max_consecutive(3), track_chr2drop(true), replace_html_entities(true) {} // General flags: // * Map tokens to spans in the original text. bool track_index_translations; // Preprocessing flags: // * Maximum number of consecutive code points before we start dropping them. // * Whether to keep track of code point drop counts from destuttering. size_t destutter_max_consecutive; bool track_chr2drop; // Tokenization flags: // * Whether to replace HTML entities in the text with their Unicode // equivalents. bool replace_html_entities; }; #endif // CC_ANALYSIS_ANALYSIS_OPTIONS_H_
#ifndef CC_ANALYSIS_ANALYSIS_OPTIONS_H_ #define CC_ANALYSIS_ANALYSIS_OPTIONS_H_ #include <cstddef> struct AnalysisOptions { AnalysisOptions() : destutter_max_consecutive(3), replace_html_entities(true) {} // Preprocessing flags: // * Maximum number of consecutive code points before we start dropping them. size_t destutter_max_consecutive; // Tokenization flags: // * Whether to replace HTML entities in the text with their Unicode // equivalents. bool replace_html_entities; }; #endif // CC_ANALYSIS_ANALYSIS_OPTIONS_H_
Improve error test for void parameter
int foo(void, int x) { return 0; } int main() { return foo(); }
int a(void, int i) { return 0; } int b(int i, void) { return 0; } int c(void, void) { return 0; } int d(void, ...) { return 0; } int main() { return 0; }
Change default khs to 4
#ifndef THERMALCONFIG_H #define THERMALCONFIG_H #ifndef M_PI const double M_PI = 3.141592653; #endif const double T0 = 273.15; // [C] const double R_TSV = 5e-6; // [m] /* Thermal conductance */ const double Ksi = 148.0; // Silicon const double Kcu = 401.0; // Copper const double Kin = 1.5; // insulator const double Khs = 2.0; // Heat sink /* Thermal capacitance */ const double Csi = 1.66e6; // Silicon const double Ccu = 3.2e6; // Copper const double Cin = 1.65e6; // insulator const double Chs = 2.42e6; // Heat sink /* Layer Hight */ const double Hsi = 400e-6; // Silicon const double Hcu = 5e-6; // Copper const double Hin = 20e-6; // Insulator const double Hhs = 1000e-6; // Heat sink #endif
#ifndef THERMALCONFIG_H #define THERMALCONFIG_H #ifndef M_PI const double M_PI = 3.141592653; #endif const double T0 = 273.15; // [C] const double R_TSV = 5e-6; // [m] /* Thermal conductance */ const double Ksi = 148.0; // Silicon const double Kcu = 401.0; // Copper const double Kin = 1.5; // insulator const double Khs = 4.0; // Heat sink /* Thermal capacitance */ const double Csi = 1.66e6; // Silicon const double Ccu = 3.2e6; // Copper const double Cin = 1.65e6; // insulator const double Chs = 2.42e6; // Heat sink /* Layer Hight */ const double Hsi = 400e-6; // Silicon const double Hcu = 5e-6; // Copper const double Hin = 20e-6; // Insulator const double Hhs = 1000e-6; // Heat sink #endif
Add tests for weak functions
// RUN: %clang_cc1 -verify -fsyntax-only %s extern int g0 __attribute__((weak)); extern int g1 __attribute__((weak_import)); int g2 __attribute__((weak)); int g3 __attribute__((weak_import)); // expected-warning {{'weak_import' attribute cannot be specified on a definition}} int __attribute__((weak_import)) g4(void); void __attribute__((weak_import)) g5(void) { } struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variables, functions, and classes}} struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variables and functions}} static int x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}} // rdar://9538608 int C; // expected-note {{previous definition is here}} extern int C __attribute__((weak_import)); // expected-warning {{an already-declared variable is made a weak_import declaration}} static int pr14946_x; extern int pr14946_x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}} static void pr14946_f(); void pr14946_f() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
// RUN: %clang_cc1 -verify -fsyntax-only %s extern int f0() __attribute__((weak)); extern int g0 __attribute__((weak)); extern int g1 __attribute__((weak_import)); int f2() __attribute__((weak)); int g2 __attribute__((weak)); int g3 __attribute__((weak_import)); // expected-warning {{'weak_import' attribute cannot be specified on a definition}} int __attribute__((weak_import)) g4(void); void __attribute__((weak_import)) g5(void) { } struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variables, functions, and classes}} struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variables and functions}} static int f() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}} static int x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}} // rdar://9538608 int C; // expected-note {{previous definition is here}} extern int C __attribute__((weak_import)); // expected-warning {{an already-declared variable is made a weak_import declaration}} static int pr14946_x; extern int pr14946_x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}} static void pr14946_f(); void pr14946_f() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
Change declaration express test macros
/** * \file express_tests.h * \date Jul 4, 2009 * \author anton * \details */ #ifndef EXPRESS_TESTS_H_ #define EXPRESS_TESTS_H_ typedef struct _EXPRESS_TEST_DESCRIPTOR { const char *name; int (*exec)(); } EXPRESS_TEST_DESCRIPTOR; #define REGISTER_EXPRESS_TEST(descr) static void _register_express_test(){ \ __asm__( \ ".section .express_tests\n\t" \ ".word %0\n\t" \ ".text\n" \ : :"i"(&descr)); \ } #define DECLARE_EXPRESS_TEST(name, exec) \ static int exec(); \ static const EXPRESS_TEST_DESCRIPTOR _descriptor = { name, exec }; \ REGISTER_EXPRESS_TEST(_descriptor); int express_tests_execute(); #endif /* EXPRESS_TESTS_H_ */
/** * \file express_tests.h * \date Jul 4, 2009 * \author anton * \details */ #ifndef EXPRESS_TESTS_H_ #define EXPRESS_TESTS_H_ typedef struct _EXPRESS_TEST_DESCRIPTOR { const char *name; int (*exec)(); } EXPRESS_TEST_DESCRIPTOR; /* #define REGISTER_EXPRESS_TEST(descr) static void _register_express_test(){ \ __asm__( \ ".section .express_tests\n\t" \ ".word %0\n\t" \ ".text\n" \ : :"i"(&descr)); \ } #define DECLARE_EXPRESS_TEST(name, exec) \ static int exec(); \ static const EXPRESS_TEST_DESCRIPTOR _descriptor = { name, exec }; \ REGISTER_EXPRESS_TEST(_descriptor); */ #define DECLARE_EXPRESS_TEST(name, exec) \ static int exec(); \ static const EXPRESS_TEST_DESCRIPTOR _descriptor = { name, exec }; \ static const EXPRESS_TEST_DESCRIPTOR *_pdescriptor __attribute__ ((section(".express_tests"))) = &_descriptor; int express_tests_execute(); #endif /* EXPRESS_TESTS_H_ */
Revert "Clean up in buildbot directories."
// RUN: rm -f %S/statements.ll // RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only void test1(int x) { switch (x) { case 111111111111111111111111111111111111111: bar(); } } // Mismatched type between return and function result. int test2() { return; } void test3() { return 4; } void test4() { bar: baz: blong: bing: ; // PR5131 static long x = &&bar - &&baz; static long y = &&baz; &&bing; &&blong; if (y) goto *y; goto *x; } // PR3869 int test5(long long b) { static void *lbls[] = { &&lbl }; goto *b; lbl: return 0; }
// RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only void test1(int x) { switch (x) { case 111111111111111111111111111111111111111: bar(); } } // Mismatched type between return and function result. int test2() { return; } void test3() { return 4; } void test4() { bar: baz: blong: bing: ; // PR5131 static long x = &&bar - &&baz; static long y = &&baz; &&bing; &&blong; if (y) goto *y; goto *x; } // PR3869 int test5(long long b) { static void *lbls[] = { &&lbl }; goto *b; lbl: return 0; }
Add missing header from previous commit
/* * This file is part of meego-im-framework * * * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * Contact: Nokia Corporation (directui@nokia.com) * * If you have questions regarding the use of this file, please contact * Nokia at directui@nokia.com. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1 as published by the Free Software Foundation * and appearing in the file LICENSE.LGPL included in the packaging * of this file. */ #ifndef UT_MIMROTATIONANIMATION_H #define UT_MIMROTATIONANIMATION_H #include <QtTest/QtTest> #include <QObject> class MIMApplication; class Ut_MImRotationAnimation : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testPassthruHiddenDuringRotation(); private: MIMApplication *app; }; #endif // UT_MIMROTATIONANIMATION_H
Change sbrk() prototype to sensible version with void * and ssize_t.
#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
#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 * ); void *sbrk( ssize_t ); int gethostname( char *, int ); #else int symlink(); char *sbrk(); int gethostname(); #endif #if defined(__cplusplus) } #endif #endif /* ULTRIX43 */ #endif
Test for llvm-gcc patch 78762.
// RUN: %llvmgcc %s -fasm-blocks -S -o - | grep {\\\*1192} // Complicated expression as jump target // XFAIL: * // XTARGET: darwin asm void Method3() { mov eax,[esp+4] jmp [eax+(299-1)*4] }
Copy code from vim to check stack grow direction.
// from vim(os_unix.c) /* * Find out if the stack grows upwards or downwards. * "p" points to a variable on the stack of the caller. */ static void check_stack_growth(p) char *p; { int i; stack_grows_downwards = (p > (char *)&i); }
Synchronize the mailbox after expunging messages to actually get them expunged.
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" #include "commands.h" #include "imap-expunge.h" bool cmd_close(struct client_command_context *cmd) { struct client *client = cmd->client; struct mailbox *mailbox = client->mailbox; struct mail_storage *storage; if (!client_verify_open_mailbox(cmd)) return TRUE; storage = mailbox_get_storage(mailbox); client->mailbox = NULL; if (!imap_expunge(mailbox, NULL)) client_send_untagged_storage_error(client, storage); if (mailbox_close(&mailbox) < 0) client_send_untagged_storage_error(client, storage); client_update_mailbox_flags(client, NULL); client_send_tagline(cmd, "OK Close completed."); return TRUE; }
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" #include "commands.h" #include "imap-expunge.h" bool cmd_close(struct client_command_context *cmd) { struct client *client = cmd->client; struct mailbox *mailbox = client->mailbox; struct mail_storage *storage; if (!client_verify_open_mailbox(cmd)) return TRUE; storage = mailbox_get_storage(mailbox); client->mailbox = NULL; if (!imap_expunge(mailbox, NULL)) client_send_untagged_storage_error(client, storage); else if (mailbox_sync(mailbox, 0, 0, NULL) < 0) client_send_untagged_storage_error(client, storage); if (mailbox_close(&mailbox) < 0) client_send_untagged_storage_error(client, storage); client_update_mailbox_flags(client, NULL); client_send_tagline(cmd, "OK Close completed."); return TRUE; }
Fix ‘strncpy’ was not declared in this scope
#ifndef HELPERS_H #define HELPERS_H #include <stdlib.h> #include <netdb.h> #include <arpa/inet.h> #include <errno.h> #include <string> #define RCV_SIZE 2 char * get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen); char * addrinfo_to_ip(const addrinfo info, char * ip); void *get_in_addr(const sockaddr *sa); std::string recieveFrom(const int sock, char * buffer); std::string split_message(std::string * key, std::string message); #endif // HELPERS_H
#ifndef HELPERS_H #define HELPERS_H #include <stdlib.h> #include <netdb.h> #include <arpa/inet.h> #include <errno.h> #include <cstring> #include <string> #define RCV_SIZE 2 char * get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen); char * addrinfo_to_ip(const addrinfo info, char * ip); void *get_in_addr(const sockaddr *sa); std::string recieveFrom(const int sock, char * buffer); std::string split_message(std::string * key, std::string message); #endif // HELPERS_H
Make ReadDataFromGlobal() and FoldReinterpretLoadFromConstPtr() Big-endian-aware.
// RUN: %clang -target i686-unknown-unknown -O3 -emit-llvm -S -o - %s | FileCheck %s long long f0(void) { struct { unsigned f0 : 32; } x = { 18 }; return (long long) (x.f0 - (int) 22); } // CHECK: @f0() // CHECK: ret i64 4294967292 long long f1(void) { struct { unsigned f0 : 31; } x = { 18 }; return (long long) (x.f0 - (int) 22); } // CHECK: @f1() // CHECK: ret i64 -4 long long f2(void) { struct { unsigned f0 ; } x = { 18 }; return (long long) (x.f0 - (int) 22); } // CHECK: @f2() // CHECK: ret i64 4294967292
// RUN: %clang -O3 -emit-llvm -S -o - %s | FileCheck %s long long f0(void) { struct { unsigned f0 : 32; } x = { 18 }; return (long long) (x.f0 - (int) 22); } // CHECK: @f0() // CHECK: ret i64 4294967292 long long f1(void) { struct { unsigned f0 : 31; } x = { 18 }; return (long long) (x.f0 - (int) 22); } // CHECK: @f1() // CHECK: ret i64 -4 long long f2(void) { struct { unsigned f0 ; } x = { 18 }; return (long long) (x.f0 - (int) 22); } // CHECK: @f2() // CHECK: ret i64 4294967292
Add header file for RISCV_EFI_BOOT_PROTOCOL
/** @file Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ /*++ Module Name: RiscVBoot.h Abstract: This UEFI protocol for RISC-V systems provides early information to the bootloaders or Operating Systems. Firmwares like EDK2/u-boot need to implement this protocol on RISC-V UEFI systems. --*/ #ifndef _RISCV_BOOT_H_ #define _RISCV_BOOT_H_ // // Global ID for the RISC-V Boot Protocol // #define RISCV_EFI_BOOT_PROTOCOL_GUID \ { 0xccd15fec, 0x6f73, 0x4eec, { 0x83, 0x95, 0x3e, 0x69, 0xe4, 0xb9, 0x40, 0xbf } } typedef struct _RISCV_EFI_BOOT_PROTOCOL RISCV_EFI_BOOT_PROTOCOL; typedef EFI_STATUS (EFIAPI *EFI_GET_BOOT_HARTID) ( IN RISCV_EFI_BOOT_PROTOCOL *This, OUT UINTN *BootHartId ) /*++ Routine Description: This interface provides the hartid of the boot cpu. Arguments: This - Protocol instance pointer. BootHartId - Pointer to the variable receiving the hartid of the boot cpu. Returns: EFI_SUCCESS - The boot hart id could be returned. EFI_INVALID_PARAMETER - This parameter is NULL or does not point to a valid RISCV_EFI_BOOT_PROTOCOL implementation. EFI_INVALID_PARAMETER - BootHartId parameter is NULL. --*/ ; // // Interface structure for the RISC-V Boot Protocol // struct _RISCV_EFI_BOOT_PROTOCOL { UINTN Revision; EFI_GET_BOOT_HARTID GetBootHartId; }; extern EFI_GUID gBlackBoxEfiRiscVBootProtocolGuid; #endif
Make EvdevBitIsSet return a bool
// Copyright 2014 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 UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_UTIL_H_ #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_UTIL_H_ #include <limits.h> namespace ui { #define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) #define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) static inline int EvdevBitIsSet(const unsigned long* data, int bit) { return data[bit / EVDEV_LONG_BITS] & (1UL << (bit % EVDEV_LONG_BITS)); } } // namespace ui #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_UTIL_H_
// Copyright 2014 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 UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_UTIL_H_ #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_UTIL_H_ #include <limits.h> namespace ui { #define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) #define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) static inline bool EvdevBitIsSet(const unsigned long* data, int bit) { return data[bit / EVDEV_LONG_BITS] & (1UL << (bit % EVDEV_LONG_BITS)); } } // namespace ui #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_UTIL_H_
Add slip-radio interface module for cooja-radio
/* * Copyright (c) 2011, Swedish Institute of Computer Science * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This file is part of the Contiki operating system. * * Sets up some commands for the CC2420 radio chip. */ #include "contiki.h" #include "contiki-net.h" #include "cooja-radio.h" #include "cmd.h" #include <stdio.h> #include <string.h> #include "net/mac/frame802154.h" int cmd_handler_cooja(const uint8_t *data, int len) { if(data[0] == '!') { if(data[1] == 'C' && len == 3) { printf("cooja_cmd: setting channel: %d\n", data[2]); radio_set_channel(data[2]); return 1; } else if(data[1] == 'M' && len == 10) { printf("cooja_cmd: Got MAC\n"); memcpy(uip_lladdr.addr, data+2, sizeof(uip_lladdr.addr)); linkaddr_set_node_addr((linkaddr_t *) uip_lladdr.addr); return 1; } } else if(data[0] == '?') { if(data[1] == 'C' && len == 2) { uint8_t buf[4]; printf("cooja_cmd: getting channel: %d\n", data[2]); buf[0] = '!'; buf[1] = 'C'; buf[2] = 0; cmd_send(buf, 3); return 1; } } return 0; }
Fix order of property attributes
// // Copyright (c) 2015 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to 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. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // Copyright (c) 2015 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to 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. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (nonatomic, strong) UIWindow *window; @end
Include port number in col_log() output.
#include <stdarg.h> #include "col-internal.h" struct ColLogger { ColInstance *col; /* This is reset on each call to col_log() */ apr_pool_t *tmp_pool; }; ColLogger * logger_make(ColInstance *col) { ColLogger *logger; logger = apr_pcalloc(col->pool, sizeof(*logger)); logger->tmp_pool = make_subpool(col->pool); return logger; } void col_log(ColInstance *col, const char *fmt, ...) { va_list args; char *str; va_start(args, fmt); str = apr_pvsprintf(col->log->tmp_pool, fmt, args); va_end(args); fprintf(stdout, "LOG: %s\n", str); apr_pool_clear(col->log->tmp_pool); } char * log_tuple(ColInstance *col, Tuple *tuple) { char *tuple_str = tuple_to_str(tuple, col->log->tmp_pool); return apr_pstrcat(col->log->tmp_pool, "{", tuple_str, "}", NULL); } char * log_datum(ColInstance *col, Datum datum, DataType type) { StrBuf *sbuf; sbuf = sbuf_make(col->log->tmp_pool); datum_to_str(datum, type, sbuf); sbuf_append_char(sbuf, '\0'); return sbuf->data; }
#include <stdarg.h> #include "col-internal.h" struct ColLogger { ColInstance *col; /* This is reset on each call to col_log() */ apr_pool_t *tmp_pool; }; ColLogger * logger_make(ColInstance *col) { ColLogger *logger; logger = apr_pcalloc(col->pool, sizeof(*logger)); logger->tmp_pool = make_subpool(col->pool); return logger; } void col_log(ColInstance *col, const char *fmt, ...) { va_list args; char *str; va_start(args, fmt); str = apr_pvsprintf(col->log->tmp_pool, fmt, args); va_end(args); fprintf(stdout, "LOG (%d): %s\n", col->port, str); apr_pool_clear(col->log->tmp_pool); } char * log_tuple(ColInstance *col, Tuple *tuple) { char *tuple_str = tuple_to_str(tuple, col->log->tmp_pool); return apr_pstrcat(col->log->tmp_pool, "{", tuple_str, "}", NULL); } char * log_datum(ColInstance *col, Datum datum, DataType type) { StrBuf *sbuf; sbuf = sbuf_make(col->log->tmp_pool); datum_to_str(datum, type, sbuf); sbuf_append_char(sbuf, '\0'); return sbuf->data; }
Use option + for TAttParticle and TPrimary
/* @(#)root/eg:$Name: $:$Id: LinkDef.h,v 1.2 2000/09/06 15:15:18 brun Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class TParticle-; #pragma link C++ class TAttParticle; #pragma link C++ class TPrimary; #pragma link C++ class TGenerator-; #pragma link C++ class TDatabasePDG+; #pragma link C++ class TParticlePDG+; #endif
/* @(#)root/eg:$Name: $:$Id: LinkDef.h,v 1.3 2000/09/08 16:42:12 brun Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class TParticle-; #pragma link C++ class TAttParticle+; #pragma link C++ class TPrimary+; #pragma link C++ class TGenerator+; #pragma link C++ class TDatabasePDG+; #pragma link C++ class TParticlePDG+; #endif
Include sqlite3 in bridging header.
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "SQLPackRat.h"
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "SQLPackRat.h" #import <sqlite3.h>
Call free_irq() only if request_irq() was successful
/* * Copyright IBM Corp. 2001,2008 * * This file contains the IRQ specific code for hvc_console * */ #include <linux/interrupt.h> #include "hvc_console.h" static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance) { /* if hvc_poll request a repoll, then kick the hvcd thread */ if (hvc_poll(dev_instance)) hvc_kick(); return IRQ_HANDLED; } /* * For IRQ based systems these callbacks can be used */ int notifier_add_irq(struct hvc_struct *hp, int irq) { int rc; if (!irq) { hp->irq_requested = 0; return 0; } rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp); if (!rc) hp->irq_requested = 1; return rc; } void notifier_del_irq(struct hvc_struct *hp, int irq) { if (!irq) return; free_irq(irq, hp); hp->irq_requested = 0; } void notifier_hangup_irq(struct hvc_struct *hp, int irq) { notifier_del_irq(hp, irq); }
/* * Copyright IBM Corp. 2001,2008 * * This file contains the IRQ specific code for hvc_console * */ #include <linux/interrupt.h> #include "hvc_console.h" static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance) { /* if hvc_poll request a repoll, then kick the hvcd thread */ if (hvc_poll(dev_instance)) hvc_kick(); return IRQ_HANDLED; } /* * For IRQ based systems these callbacks can be used */ int notifier_add_irq(struct hvc_struct *hp, int irq) { int rc; if (!irq) { hp->irq_requested = 0; return 0; } rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp); if (!rc) hp->irq_requested = 1; return rc; } void notifier_del_irq(struct hvc_struct *hp, int irq) { if (!hp->irq_requested) return; free_irq(irq, hp); hp->irq_requested = 0; } void notifier_hangup_irq(struct hvc_struct *hp, int irq) { notifier_del_irq(hp, irq); }
Make method_generate a static method
#include <ruby.h> #include <uuid/uuid.h> // Define our module constant VALUE CUUID = Qnil; // Prototype this void Init_cuuid(); // Prototype CUUID.generate VALUE method_generate(); // Define CUUID and the fact it has a class method called generate void Init_cuuid() { int arg_count = 0; CUUID = rb_define_module("CUUID"); rb_define_module_function(CUUID, "generate", method_generate, arg_count); } // Implement CUUID.generate VALUE method_generate(VALUE self) { uuid_t uuid_id; char uuid_str[128]; // Generate UUID and grab string version of it uuid_generate(uuid_id); uuid_unparse(uuid_id, uuid_str); // Cast it into a ruby string and return it return rb_str_new2(uuid_str); }
#include <ruby.h> #include <uuid/uuid.h> // Define our module constant VALUE CUUID = Qnil; // Prototype this void Init_cuuid(); // Prototype CUUID.generate VALUE method_generate(); // Define CUUID and the fact it has a class method called generate void Init_cuuid() { int arg_count = 0; CUUID = rb_define_module("CUUID"); rb_define_module_function(CUUID, "generate", method_generate, arg_count); } // Implement CUUID.generate static VALUE method_generate(VALUE self) { uuid_t uuid_id; char uuid_str[128]; // Generate UUID and grab string version of it uuid_generate(uuid_id); uuid_unparse(uuid_id, uuid_str); // Cast it into a ruby string and return it return rb_str_new2(uuid_str); }
Work around byteswap bug in gcc < 4.2
/* * AVR32 endian-conversion functions. */ #ifndef __ASM_AVR32_BYTEORDER_H #define __ASM_AVR32_BYTEORDER_H #include <asm/types.h> #include <linux/compiler.h> #ifdef __CHECKER__ extern unsigned long __builtin_bswap_32(unsigned long x); extern unsigned short __builtin_bswap_16(unsigned short x); #endif #define __arch__swab32(x) __builtin_bswap_32(x) #define __arch__swab16(x) __builtin_bswap_16(x) #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) # define __BYTEORDER_HAS_U64__ # define __SWAB_64_THRU_32__ #endif #include <linux/byteorder/big_endian.h> #endif /* __ASM_AVR32_BYTEORDER_H */
/* * AVR32 endian-conversion functions. */ #ifndef __ASM_AVR32_BYTEORDER_H #define __ASM_AVR32_BYTEORDER_H #include <asm/types.h> #include <linux/compiler.h> #ifdef __CHECKER__ extern unsigned long __builtin_bswap_32(unsigned long x); extern unsigned short __builtin_bswap_16(unsigned short x); #endif /* * avr32-linux-gcc versions earlier than 4.2 improperly sign-extends * the result. */ #if !(__GNUC__ == 4 && __GNUC_MINOR__ < 2) #define __arch__swab32(x) __builtin_bswap_32(x) #define __arch__swab16(x) __builtin_bswap_16(x) #endif #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) # define __BYTEORDER_HAS_U64__ # define __SWAB_64_THRU_32__ #endif #include <linux/byteorder/big_endian.h> #endif /* __ASM_AVR32_BYTEORDER_H */
Fix build break from the future.
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_ #define CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_ #pragma once #include "base/basictypes.h" #include "base/compiler_specific.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" namespace content { class RenderView; } // This class draws the given color on a PageOverlay of a WebView. class WebViewColorOverlay : public WebKit::WebPageOverlay { public: WebViewColorOverlay(content::RenderView* render_view, SkColor color); virtual ~WebViewColorOverlay(); private: // WebKit::WebPageOverlay implementation: virtual void paintPageOverlay(WebKit::WebCanvas* canvas); content::RenderView* render_view_; SkColor color_; DISALLOW_COPY_AND_ASSIGN(WebViewColorOverlay); }; #endif // CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_ #define CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_ #pragma once #include "base/basictypes.h" #include "base/compiler_specific.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" namespace content { class RenderView; } // This class draws the given color on a PageOverlay of a WebView. class WebViewColorOverlay : public WebKit::WebPageOverlay { public: WebViewColorOverlay(content::RenderView* render_view, SkColor color); virtual ~WebViewColorOverlay(); private: // WebKit::WebPageOverlay implementation: virtual void paintPageOverlay(WebKit::WebCanvas* canvas); content::RenderView* render_view_; SkColor color_; DISALLOW_COPY_AND_ASSIGN(WebViewColorOverlay); }; #endif // CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
Add symb_locks test with irrelevant index access
// PARAM: --disable ana.mutex.disjoint_types --set ana.activated[+] "'var_eq'" --set ana.activated[+] "'symb_locks'" // copy of 06/02 with additional index accesses #include<pthread.h> #include<stdio.h> struct cache_entry { int refs; pthread_mutex_t refs_mutex; } cache[10]; void cache_entry_addref(struct cache_entry *entry) { pthread_mutex_lock(&entry->refs_mutex); entry->refs++; // NORACE (*entry).refs++; // NORACE entry[0].refs++; // NORACE pthread_mutex_unlock(&entry->refs_mutex); } void *t_fun(void *arg) { int i; for(i=0; i<10; i++) cache_entry_addref(&cache[i]); // NORACE return NULL; } int main () { for (int i = 0; i < 10; i++) pthread_mutex_init(&cache[i].refs_mutex, NULL); int i; pthread_t t1; pthread_create(&t1, NULL, t_fun, NULL); for(i=0; i<10; i++) cache_entry_addref(&cache[i]); // NORACE return 0; }
Make totally unnecessary AttributeChange class namespace instead keeping syntax intact.
/** For conditions of distribution and use, see copyright notice in LICENSE @file AttributeChangeType.h @brief Dummy class containing enumeration of attribute/component change types for replication. This is done in separate file in order to overcome cyclic inclusion dependency between IAttribute and IComponent. */ #pragma once #include "TundraCoreApi.h" namespace Tundra { /// Dummy class containing enumeration of attribute/component change types for replication. class TUNDRACORE_API AttributeChange { public: /// Enumeration of attribute/component change types for replication enum Type { /// Use the current sync method specified in the IComponent this attribute is part of Default = 0, /// The value will be changed, but no notifications will be sent (even locally). This /// is useful when you are doing batch updates of several attributes at a time and want to minimize /// the amount of re-processing that is done. Disconnected, /// The value change will be signalled locally immediately after the change occurs, but /// it is not sent to the network. LocalOnly, /// Replicate: After changing the value, the change will be signalled locally and this change is /// transmitted to the network as well. Replicate }; }; }
/** For conditions of distribution and use, see copyright notice in LICENSE @file AttributeChangeType.h @brief Enumeration of attribute/component change types for replication. This is done in separate file in order to overcome cyclic inclusion dependency between IAttribute and IComponent. */ #pragma once #include "TundraCoreApi.h" namespace Tundra { namespace AttributeChange { /// Enumeration of attribute/component change types for replication enum Type { /// Use the current sync method specified in the IComponent this attribute is part of Default = 0, /// The value will be changed, but no notifications will be sent (even locally). This /// is useful when you are doing batch updates of several attributes at a time and want to minimize /// the amount of re-processing that is done. Disconnected, /// The value change will be signalled locally immediately after the change occurs, but /// it is not sent to the network. LocalOnly, /// Replicate: After changing the value, the change will be signalled locally and this change is /// transmitted to the network as well. Replicate }; } // ~AttributeChange } // ~Tundra
Add missing protocol header file.
/** @file Utility functions which helps in opcode creation, HII configuration string manipulations, pop up window creations, setup browser persistence data set and get. Copyright (c) 2007 - 2008, 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 _IFRLIBRARY_INTERNAL_H_ #define _IFRLIBRARY_INTERNAL_H_ #include <Uefi.h> #include <Protocol/DevicePath.h> #include <Library/DebugLib.h> #include <Library/BaseMemoryLib.h> #include <Library/UefiBootServicesTableLib.h> #include <Library/BaseLib.h> #include <Library/DevicePathLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/IfrSupportLib.h> #endif
/** @file Utility functions which helps in opcode creation, HII configuration string manipulations, pop up window creations, setup browser persistence data set and get. Copyright (c) 2007 - 2008, 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 _IFRLIBRARY_INTERNAL_H_ #define _IFRLIBRARY_INTERNAL_H_ #include <Uefi.h> #include <Protocol/DevicePath.h> #include <Protocol/HiiConfigRouting.h> #include <Protocol/FormBrowser2.h> #include <Library/DebugLib.h> #include <Library/BaseMemoryLib.h> #include <Library/UefiBootServicesTableLib.h> #include <Library/BaseLib.h> #include <Library/DevicePathLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/IfrSupportLib.h> #endif
Update initWithBaseURL to take a URL
// // AVEHTTPRequestOperationBuilder.h // Avenue // // Created by MediaHound on 10/31/14. // // #import <Foundation/Foundation.h> #import <AFNetworking/AFNetworking.h> #import "AVERequestBuilder.h" /** * A simple AVERequestBuilder that can be configured with a baseURL, request/response serializers, * and a security policy. * * Typically, you can instantiate and configure a single AVEHTTPRequestOperationBuilder, * and reususe it when passing in a builder to `AVENetworkManager` methods. */ @interface AVEHTTPRequestOperationBuilder : NSObject <AVERequestBuilder> /** * Creates a builder with a base URL. */ - (instancetype)initWithBaseURL:(NSString*)url; /** * The builders' base URL * All operations built will use this base URL. */ @property (strong, nonatomic) NSURL* baseURL; /** * The request serializer for all built operations */ @property (strong, nonatomic) AFHTTPRequestSerializer<AFURLRequestSerialization>* requestSerializer; /** * The response serializer for all built operations */ @property (strong, nonatomic) AFHTTPResponseSerializer<AFURLResponseSerialization>* responseSerializer; /** * The security policy for all built operations */ @property (strong, nonatomic) AFSecurityPolicy* securityPolicy; @end
// // AVEHTTPRequestOperationBuilder.h // Avenue // // Created by MediaHound on 10/31/14. // // #import <Foundation/Foundation.h> #import <AFNetworking/AFNetworking.h> #import "AVERequestBuilder.h" /** * A simple AVERequestBuilder that can be configured with a baseURL, request/response serializers, * and a security policy. * * Typically, you can instantiate and configure a single AVEHTTPRequestOperationBuilder, * and reususe it when passing in a builder to `AVENetworkManager` methods. */ @interface AVEHTTPRequestOperationBuilder : NSObject <AVERequestBuilder> /** * Creates a builder with a base URL. */ - (instancetype)initWithBaseURL:(NSURL*)url; /** * The builders' base URL * All operations built will use this base URL. */ @property (strong, nonatomic) NSURL* baseURL; /** * The request serializer for all built operations */ @property (strong, nonatomic) AFHTTPRequestSerializer<AFURLRequestSerialization>* requestSerializer; /** * The response serializer for all built operations */ @property (strong, nonatomic) AFHTTPResponseSerializer<AFURLResponseSerialization>* responseSerializer; /** * The security policy for all built operations */ @property (strong, nonatomic) AFSecurityPolicy* securityPolicy; @end
Remove a stale forward declaration.
//===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file exposes an interface to promote alloca instructions to SSA // registers, by using the SSA construction algorithm. // //===----------------------------------------------------------------------===// #ifndef TRANSFORMS_UTILS_PROMOTEMEMTOREG_H #define TRANSFORMS_UTILS_PROMOTEMEMTOREG_H #include <vector> namespace llvm { class AllocaInst; class DominatorTree; class DominanceFrontier; class AliasSetTracker; /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... /// bool isAllocaPromotable(const AllocaInst *AI); /// PromoteMemToReg - Promote the specified list of alloca instructions into /// scalar registers, inserting PHI nodes as appropriate. This function makes /// use of DominanceFrontier information. This function does not modify the CFG /// of the function at all. All allocas must be from the same function. /// /// If AST is specified, the specified tracker is updated to reflect changes /// made to the IR. /// void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas, DominatorTree &DT, AliasSetTracker *AST = 0); } // End llvm namespace #endif
//===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file exposes an interface to promote alloca instructions to SSA // registers, by using the SSA construction algorithm. // //===----------------------------------------------------------------------===// #ifndef TRANSFORMS_UTILS_PROMOTEMEMTOREG_H #define TRANSFORMS_UTILS_PROMOTEMEMTOREG_H #include <vector> namespace llvm { class AllocaInst; class DominatorTree; class AliasSetTracker; /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... /// bool isAllocaPromotable(const AllocaInst *AI); /// PromoteMemToReg - Promote the specified list of alloca instructions into /// scalar registers, inserting PHI nodes as appropriate. This function makes /// use of DominanceFrontier information. This function does not modify the CFG /// of the function at all. All allocas must be from the same function. /// /// If AST is specified, the specified tracker is updated to reflect changes /// made to the IR. /// void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas, DominatorTree &DT, AliasSetTracker *AST = 0); } // End llvm namespace #endif
Add tagname attribute for HTML Element
// // HTMLElement.h // HTMLKit // // Created by Iska on 05/10/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> @interface HTMLElement : NSObject @end
// // HTMLElement.h // HTMLKit // // Created by Iska on 05/10/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> @interface HTMLElement : NSObject @property (nonatomic, strong, readonly) NSString *tagName; @end
Add missing hal_rng config used by random mod.
#ifndef NRF52_HAL_CONF_H__ #define NRF52_HAL_CONF_H__ #define HAL_UART_MODULE_ENABLED #define HAL_SPI_MODULE_ENABLED #define HAL_TIME_MODULE_ENABLED #define HAL_PWM_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED #define HAL_TIMER_MODULE_ENABLED #define HAL_TWI_MODULE_ENABLED #define HAL_ADCE_MODULE_ENABLED #define HAL_TEMP_MODULE_ENABLED // #define HAL_UARTE_MODULE_ENABLED // #define HAL_SPIE_MODULE_ENABLED // #define HAL_TWIE_MODULE_ENABLED #endif // NRF52_HAL_CONF_H__
#ifndef NRF52_HAL_CONF_H__ #define NRF52_HAL_CONF_H__ #define HAL_UART_MODULE_ENABLED #define HAL_SPI_MODULE_ENABLED #define HAL_TIME_MODULE_ENABLED #define HAL_PWM_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED #define HAL_TIMER_MODULE_ENABLED #define HAL_TWI_MODULE_ENABLED #define HAL_ADCE_MODULE_ENABLED #define HAL_TEMP_MODULE_ENABLED #define HAL_RNG_MODULE_ENABLED // #define HAL_UARTE_MODULE_ENABLED // #define HAL_SPIE_MODULE_ENABLED // #define HAL_TWIE_MODULE_ENABLED #endif // NRF52_HAL_CONF_H__
Add failing test case due to buggy Enums.leq
//PARAM: --sets ana.int.refinement once --enable ana.int.enums int main() { int x; _Bool c; if(c) { x--;} else { x--;} // The veryfier claimed that the fixed-point was not reached here due to a bug in Enums.leq // The leq wrongly returned false for the Enums {0} and not{}[0,1] return 0; }
Fix error in plugin description
/* * (C) Copyright 2013 Kurento (http://kurento.org/) * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-2.1.html * * 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. * */ #include <config.h> #include <gst/gst.h> #include "kmscrowddetector.h" static gboolean init (GstPlugin * plugin) { if (!kms_crowd_detector_plugin_init (plugin)) return FALSE; return TRUE; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, kmscrowddetector, "Kurento plate detector", init, VERSION, GST_LICENSE_UNKNOWN, "Kurento", "http://kurento.com/")
/* * (C) Copyright 2013 Kurento (http://kurento.org/) * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-2.1.html * * 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. * */ #include <config.h> #include <gst/gst.h> #include "kmscrowddetector.h" static gboolean init (GstPlugin * plugin) { if (!kms_crowd_detector_plugin_init (plugin)) return FALSE; return TRUE; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, kmscrowddetector, "Kurento crowd detector", init, VERSION, GST_LICENSE_UNKNOWN, "Kurento", "http://kurento.com/")
Document all the public properties and methods
// // PBWebViewController.h // Pinbrowser // // Created by Mikael Konutgan on 11/02/2013. // Copyright (c) 2013 Mikael Konutgan. All rights reserved. // #import <UIKit/UIKit.h> @interface PBWebViewController : UIViewController <UIWebViewDelegate> @property (strong, nonatomic) NSURL *URL; @property (strong, nonatomic) NSArray *activityItems; @property (strong, nonatomic) NSArray *applicationActivities; @property (strong, nonatomic) NSArray *excludedActivityTypes; /** * A Boolean indicating whether the web view controller’s toolbar, * which displays a stop/refresh, back, forward and share button, is shown. * The default value of this property is `YES`. */ @property (assign, nonatomic) BOOL showsNavigationToolbar; - (void)load; - (void)clear; @end
// // PBWebViewController.h // Pinbrowser // // Created by Mikael Konutgan on 11/02/2013. // Copyright (c) 2013 Mikael Konutgan. All rights reserved. // #import <UIKit/UIKit.h> @interface PBWebViewController : UIViewController <UIWebViewDelegate> /** * The URL that will be loaded by the web view controller. * If there is one present when the web view appears, it will be automatically loaded, by calling `load`, * Otherwise, you can set a `URL` after the web view has already been loaded and then manually call `load`. */ @property (strong, nonatomic) NSURL *URL; /** The array of data objects on which to perform the activity. */ @property (strong, nonatomic) NSArray *activityItems; /** An array of UIActivity objects representing the custom services that your application supports. */ @property (strong, nonatomic) NSArray *applicationActivities; /** The list of services that should not be displayed. */ @property (strong, nonatomic) NSArray *excludedActivityTypes; /** * A Boolean indicating whether the web view controller’s toolbar, * which displays a stop/refresh, back, forward and share button, is shown. * The default value of this property is `YES`. */ @property (assign, nonatomic) BOOL showsNavigationToolbar; /** * Loads the given `URL`. This is called automatically when the when the web view appears if a `URL` exists, * otehrwise it can be called manually. */ - (void)load; /** * Clears the contents of the web view. */ - (void)clear; @end
Fix legal comment build error
// [WriteFile Name=SetInitialMapLocation, Category=Maps] // [Legal] // Copyright 2015 Esri. // 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. s// [Legal] #ifndef SET_INITIAL_MAP_LOCATION_H #define SET_INITIAL_MAP_LOCATION_H namespace Esri { namespace ArcGISRuntime { class Map; class MapQuickView; } } #include <QQuickItem> class SetInitialMapLocation : public QQuickItem { Q_OBJECT public: SetInitialMapLocation(QQuickItem* parent = 0); ~SetInitialMapLocation(); void componentComplete() Q_DECL_OVERRIDE; private: Esri::ArcGISRuntime::Map* m_map; Esri::ArcGISRuntime::MapQuickView* m_mapView; }; #endif // SET_INITIAL_MAP_LOCATION_H
// [WriteFile Name=SetInitialMapLocation, Category=Maps] // [Legal] // Copyright 2015 Esri. // 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. // [Legal] #ifndef SET_INITIAL_MAP_LOCATION_H #define SET_INITIAL_MAP_LOCATION_H namespace Esri { namespace ArcGISRuntime { class Map; class MapQuickView; } } #include <QQuickItem> class SetInitialMapLocation : public QQuickItem { Q_OBJECT public: SetInitialMapLocation(QQuickItem* parent = 0); ~SetInitialMapLocation(); void componentComplete() Q_DECL_OVERRIDE; private: Esri::ArcGISRuntime::Map* m_map; Esri::ArcGISRuntime::MapQuickView* m_mapView; }; #endif // SET_INITIAL_MAP_LOCATION_H
Make explicit the casts and floor division in pow_elem function
#include<2D_element_arithmetic.h> matrix * elem_matrix_operation(elem (*fp)(elem, float), matrix * m, float param) { int i, j = 0; for(i = 0; i < m->rows; i++) { for(j =0; j < m->columns; j++) { set_matrix_member(m, i+1, j+1, (*fp)(m->arr[i*m->columns +j], param)); } } return m; } elem pow_elem(elem x, float p) { return (elem)pow(x, p); } elem sqroot_elem(elem x, float p) { float r = (float)1 / p; return pow_elem(x, r); }
#include<2D_element_arithmetic.h> matrix * elem_matrix_operation(elem (*fp)(elem, float), matrix * m, float param) { int i, j = 0; for(i = 0; i < m->rows; i++) { for(j =0; j < m->columns; j++) { set_matrix_member(m, i+1, j+1, (*fp)(m->arr[i*m->columns +j], param)); } } return m; } elem pow_elem(elem x, float p) { return (elem)floor(pow((float)x, p)); } elem sqroot_elem(elem x, float p) { float r = (float)1 / p; return pow_elem(x, r); }
Enhance compound literal test case.
// RUN: clang -checker-simple -verify %s int* f1() { int x = 0; return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}} } int* f2(int y) { return &y; // expected-warning{{Address of stack memory associated with local variable 'y' returned.}} expected-warning{{address of stack memory associated with local variable 'y' returned}} } int* f3(int x, int *y) { int w = 0; if (x) y = &w; return y; // expected-warning{{Address of stack memory associated with local variable 'w' returned.}} } void* compound_literal(int x) { if (x) return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}} int* array[] = {}; struct s { int z; double y; int w; }; return &((struct s){ 2, 0.4, 5 * 8 }); // expected-warning{{Address of stack memory}} }
// RUN: clang -checker-simple -verify %s int* f1() { int x = 0; return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}} } int* f2(int y) { return &y; // expected-warning{{Address of stack memory associated with local variable 'y' returned.}} expected-warning{{address of stack memory associated with local variable 'y' returned}} } int* f3(int x, int *y) { int w = 0; if (x) y = &w; return y; // expected-warning{{Address of stack memory associated with local variable 'w' returned.}} } void* compound_literal(int x, int y) { if (x) return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}} int* array[] = {}; struct s { int z; double y; int w; }; if (y) return &((struct s){ 2, 0.4, 5 * 8 }); // expected-warning{{Address of stack memory}} void* p = &((struct s){ 42, 0.4, x ? 42 : 0 }); return p; }
Add a newline at the end of the file.
/*===---- varargs.h - Variable argument handling -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __VARARGS_H #define __VARARGS_H #error "Please use <stdarg.h> instead of <varargs.h>" #endif
/*===---- varargs.h - Variable argument handling -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __VARARGS_H #define __VARARGS_H #error "Please use <stdarg.h> instead of <varargs.h>" #endif
Update to use DOS format
/** @file Implement a utility function named R8_EfiLibCompareLanguage. Copyright (c) 2007 - 2008, 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 __R8_LIB_H__ #define __R8_LIB_H__ /** Compare whether two names of languages are identical. @param Language1 Name of language 1 @param Language2 Name of language 2 @retval TRUE same @retval FALSE not same **/ BOOLEAN R8_EfiLibCompareLanguage ( IN CHAR8 *Language1, IN CHAR8 *Language2 ) ; #endif
/** @file Implement a utility function named R8_EfiLibCompareLanguage. Copyright (c) 2007 - 2008, 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 __R8_LIB_H__ #define __R8_LIB_H__ /** Compare whether two names of languages are identical. @param Language1 Name of language 1 @param Language2 Name of language 2 @retval TRUE same @retval FALSE not same **/ BOOLEAN R8_EfiLibCompareLanguage ( IN CHAR8 *Language1, IN CHAR8 *Language2 ) ; #endif
Make language by code public.
// // LKManager.h // // Created by Vlad Gorbenko on 4/21/15. // Copyright (c) 2015 Vlad Gorbenko. All rights reserved. // #import <Foundation/Foundation.h> #import "LKLanguage.h" extern NSString *const LKLanguageDidChangeNotification; extern NSString *const LKSourceDefault; extern NSString *const LKSourcePlist; NSString *LKLocalizedString(NSString *key, NSString *comment); @interface LKManager : NSObject{ NSDictionary *_vocabluary; } @property (nonatomic, strong) LKLanguage *currentLanguage; @property (nonatomic, readonly) NSArray *languages; + (void)setLocalizationFilename:(NSString *)localizationFilename; + (LKManager*)sharedInstance; + (void)nextLanguage; - (NSString *)titleForKeyPathIdentifier:(NSString *)keyPathIdentifier; + (NSMutableArray *)simpleViews; + (NSMutableArray *)rightToLeftLanguagesCodes; + (void)addLanguage:(LKLanguage *)language; + (void)removeLanguage:(LKLanguage *)language; - (NSString *)setLocalizationSource:(NSString *)source; @end
// // LKManager.h // // Created by Vlad Gorbenko on 4/21/15. // Copyright (c) 2015 Vlad Gorbenko. All rights reserved. // #import <Foundation/Foundation.h> #import "LKLanguage.h" extern NSString *const LKLanguageDidChangeNotification; extern NSString *const LKSourceDefault; extern NSString *const LKSourcePlist; NSString *LKLocalizedString(NSString *key, NSString *comment); @interface LKManager : NSObject{ NSDictionary *_vocabluary; } @property (nonatomic, strong) LKLanguage *currentLanguage; @property (nonatomic, readonly) NSArray *languages; + (void)setLocalizationFilename:(NSString *)localizationFilename; + (LKManager*)sharedInstance; + (void)nextLanguage; - (NSString *)titleForKeyPathIdentifier:(NSString *)keyPathIdentifier; + (NSMutableArray *)simpleViews; + (NSMutableArray *)rightToLeftLanguagesCodes; + (void)addLanguage:(LKLanguage *)language; + (void)removeLanguage:(LKLanguage *)language; - (LKLanguage *)languageByCode:(NSString *)code; - (NSString *)setLocalizationSource:(NSString *)source; @end
Add matrix multiplication code in C
#include <stdio.h> #include <mpi.h> int main(int argc, char *argv[]) { int numprocs, rank, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Get_processor_name(processor_name, &namelen); // TODO MPI_Finalize(); return 0; }
// mat_x num of rows equals to // mat_a num of rows #define A_ROWS 3 #define X_ROWS 3 // mat_x num of cols equals to // mat_b num of cols #define B_COLS 3 #define X_COLS 3 // mat_a num of cols should be equals to // mat_b num of rows #define A_COLS 2 #define B_ROWS 2 #include <stdio.h> // #include <mpi.h> void print_matrix(char* name, int rows, int cols, int matrix[rows][cols]) { printf("\n%s [%d][%d]\n", name, rows, cols); for (int row = 0; row < rows; row++){ for (int col = 0; col < cols; col++) printf("%d ", matrix[row][col]); printf("\n"); } } int main(int argc, char *argv[]) { int matrix_a [A_ROWS][A_COLS] = { {9, 0}, {5, 6}, {1, 2} }; int matrix_b [B_ROWS][B_COLS] = { {2, 4, 3}, {7, 8, 9} }; int matrix_x [X_ROWS][X_COLS]; // multipy matrices a and b for (int row = 0; row < A_ROWS; row++) { for (int col = 0; col < B_COLS; col++) { int sum = 0; for (int ctrl = 0; ctrl < B_ROWS; ctrl++) sum = sum + matrix_a[row][ctrl] * matrix_b[ctrl][col]; matrix_x[row][col] = sum; } } print_matrix("Matrix A", A_ROWS, A_COLS, matrix_a); print_matrix("Matrix B", B_ROWS, B_COLS, matrix_b); print_matrix("Matrix X", X_ROWS, X_COLS, matrix_x); printf("\n"); // TODO // int numprocs, rank, namelen; // char processor_name[MPI_MAX_PROCESSOR_NAME]; // MPI_Init(&argc, &argv); // MPI_Comm_size(MPI_COMM_WORLD, &numprocs); // MPI_Comm_rank(MPI_COMM_WORLD, &rank); // MPI_Get_processor_name(processor_name, &namelen); // MPI_Finalize(); return 0; }
Remove a redifinition of type 'bytes'
/* This file was auto-generated by KreMLin! */ #ifndef __Random_H #define __Random_H #include "kremlib.h" #include "config.h" #include "drng.h" #include "cpuid.h" typedef uint8_t u8; typedef uint32_t u32; typedef uint64_t u64; typedef uint8_t *bytes; uint32_t random_uint32(); uint64_t random_uint64(); void random_bytes(uint8_t *rand, uint32_t n); uint32_t randseed_uint32(); uint64_t randseed_uint64(); #endif
/* This file was auto-generated by KreMLin! */ #ifndef __Random_H #define __Random_H #include "kremlib.h" #include "config.h" #include "drng.h" #include "cpuid.h" typedef uint8_t u8; typedef uint32_t u32; typedef uint64_t u64; uint32_t random_uint32(); uint64_t random_uint64(); void random_bytes(uint8_t *rand, uint32_t n); uint32_t randseed_uint32(); uint64_t randseed_uint64(); #endif
Add web page link to the main doxygen page
/** @mainpage M-Stack @section Intro This is M-Stack, a free USB Device Stack for PIC Microcontrollers. For more information, see the <a href="group__public__api.html">Public API Page.</a> */
/** @mainpage M-Stack @section Intro This is M-Stack, a free USB Device Stack for PIC Microcontrollers. For more information, see the <a href="http://www.signal11.us/oss/m-stack">main web page.</a> For API documentation, see the <a href="group__public__api.html">Public API Page.</a> */
Add function returning Species object
/// @file /// @brief Defines SpeciedDialog class. #ifndef SPECIES_DIALOG_H #define SPECIES_DIALOG_H namespace fish_detector { class SpeciesDialog : public QDialog { Q_OBJECT #ifndef NO_TESTING friend class TestSpeciesDialog; #endif public: /// @brief Constructor. /// /// @param parent Parent widget. explicit SpeciesDialog(QWidget *parent = 0); private slots: /// @brief Emits the accepted signal. void on_ok_clicked(); /// @brief Emits the rejected signal. void on_cancel_clicked(); /// @brief Removes currently selected subspecies. void on_removeSubspecies_clicked(); /// @brief Adds a new subspecies. void on_addSubspecies_clicked(); /// @brief Returns a Species object corresponding to the dialog values. /// /// @return Species object corresponding to the dialog values. Species getSpecies(); }; } // namespace fish_detector #endif // SPECIES_DIALOG_H
/// @file /// @brief Defines SpeciesDialog class. #ifndef SPECIES_DIALOG_H #define SPECIES_DIALOG_H #include <memory> #include <QWidget> #include <QDialog> #include "fish_detector/common/species.h" namespace Ui { class SpeciesDialog; } namespace fish_detector { class SpeciesDialog : public QDialog { Q_OBJECT #ifndef NO_TESTING friend class TestSpeciesDialog; #endif public: /// @brief Constructor. /// /// @param parent Parent widget. explicit SpeciesDialog(QWidget *parent = 0); /// @brief Returns a Species object corresponding to the dialog values. /// /// @return Species object corresponding to the dialog values. Species getSpecies(); private slots: /// @brief Emits the accepted signal. void on_ok_clicked(); /// @brief Emits the rejected signal. void on_cancel_clicked(); /// @brief Removes currently selected subspecies. void on_removeSubspecies_clicked(); /// @brief Adds a new subspecies. void on_addSubspecies_clicked(); private: /// @brief Widget loaded from ui file. std::unique_ptr<Ui::SpeciesDialog> ui_; }; } // namespace fish_detector #endif // SPECIES_DIALOG_H
Add missing unversioned interface-name macro for PPP_Pdf.
// Copyright (c) 2012 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 WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_ #define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_ #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_point.h" #include "ppapi/c/pp_var.h" #define PPP_PDF_INTERFACE_1 "PPP_Pdf;1" struct PPP_Pdf_1 { // Returns an absolute URL if the position is over a link. PP_Var (*GetLinkAtPosition)(PP_Instance instance, PP_Point point); }; typedef PPP_Pdf_1 PPP_Pdf; #endif // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
// Copyright (c) 2012 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 WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_ #define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_ #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_point.h" #include "ppapi/c/pp_var.h" #define PPP_PDF_INTERFACE_1 "PPP_Pdf;1" #define PPP_PDF_INTERFACE PPP_PDF_INTERFACE_1 struct PPP_Pdf_1 { // Returns an absolute URL if the position is over a link. PP_Var (*GetLinkAtPosition)(PP_Instance instance, PP_Point point); }; typedef PPP_Pdf_1 PPP_Pdf; #endif // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
Add ugly hack for waiting that ARP cache gets populated
#include "syshead.h" #include "dst.h" #include "ip.h" #include "arp.h" int dst_neigh_output(struct sk_buff *skb) { struct iphdr *iphdr = ip_hdr(skb); struct netdev *netdev = skb->netdev; uint8_t *dmac = arp_get_hwaddr(iphdr->daddr); int rc; if (dmac) { return netdev_transmit(skb, dmac, ETH_P_IP); } else { rc = arp_request(iphdr->saddr, iphdr->daddr, netdev); free_skb(skb); return rc; } }
#include "syshead.h" #include "dst.h" #include "ip.h" #include "arp.h" int dst_neigh_output(struct sk_buff *skb) { struct iphdr *iphdr = ip_hdr(skb); struct netdev *netdev = skb->netdev; uint8_t *dmac = arp_get_hwaddr(iphdr->daddr); int rc; if (dmac) { return netdev_transmit(skb, dmac, ETH_P_IP); } else { rc = arp_request(iphdr->saddr, iphdr->daddr, netdev); while ((dmac = arp_get_hwaddr(iphdr->daddr)) == NULL) { sleep(1); } return netdev_transmit(skb, dmac, ETH_P_IP); } }
Fix DB_STRINGIFY to indirectly convert arg to a string.
/* * Copyright (c) 2008 Digital Bazaar, Inc. All rights reserved. */ #ifndef db_util_Macros_H #define db_util_Macros_H /** * Miscellaneous general use macros. */ /** * Macro statement wrapper. Adapted from glib. * Use: * if(x) DB_STMT_START { ... } DB_STMT_END; else ... */ #define DB_STMT_START do #define DB_STMT_END while (0) /** * Convert argument to a string */ #define DB_STRINGIFY(arg) #arg /** * String representing the current code location. */ #define DB_STRLOC __FILE__ ":" DB_STRINGIFY(__LINE__) #endif
/* * Copyright (c) 2008 Digital Bazaar, Inc. All rights reserved. */ #ifndef db_util_Macros_H #define db_util_Macros_H /** * Miscellaneous general use macros. */ /** * Macro statement wrapper. Adapted from glib. * Use: * if(x) DB_STMT_START { ... } DB_STMT_END; else ... */ #define DB_STMT_START do #define DB_STMT_END while (0) /** * Convert argument to a string */ #define DB_STRINGIFY_ARG(arg) #arg #define DB_STRINGIFY(arg) DB_STRINGIFY_ARG(arg) /** * String representing the current code location. */ #define DB_STRLOC __FILE__ ":" DB_STRINGIFY(__LINE__) #endif
Make this test actually test something
// RUN: %clang_cc1 -verify -fsyntax-only -Wformat -Wno-format-y2k // rdar://9504680 void foo(const char *, ...) __attribute__((__format__ (__printf__, 1, 2))); void bar(unsigned int a) { foo("%s", a); // expected-warning {{format specifies type 'char *' but the argument has type 'unsigned int'}} }
// RUN: %clang_cc1 -verify -fsyntax-only -Wformat -Wno-format-y2k %s // rdar://9504680 void foo(const char *, ...) __attribute__((__format__ (__printf__, 1, 2))); void bar(unsigned int a) { foo("%s", a); // expected-warning {{format specifies type 'char *' but the argument has type 'unsigned int'}} }
Set the id for the trace message
#include "clacks_common.h" #include "id_client.h" #include "TraceMessage.pb-c.h" #include "../transport-client/cl_transport_domsock_client.h" #include <stdio.h> #include "clacks.h" /* API Back-End */ void _clacks_trace_string_id(char *str, char *id) { int ret; TraceMessage t_msg = TRACE_MESSAGE__INIT; t_msg.act_id = "TEST"; t_msg.msg = str; t_msg.flags = 0; ret = send_trace_message(&t_msg); } /* API Front-End */ void clacks_trace_string(char *str) { clacks_trace_string_id(str, "NULLID"); } void clacks_trace_string_id(char *str, char *id) { if (str != NULL && id != NULL) { _clacks_trace_string_id(str, id); } } int clacks_new_id(char *id) { if (id == NULL) { return -1; } return get_new_id(id); }
#include "clacks_common.h" #include "id_client.h" #include "TraceMessage.pb-c.h" #include "../transport-client/cl_transport_domsock_client.h" #include <stdio.h> #include "clacks.h" /* API Back-End */ void _clacks_trace_string_id(char *str, char *id) { int ret; TraceMessage t_msg = TRACE_MESSAGE__INIT; t_msg.act_id = id; t_msg.msg = str; t_msg.flags = 0; ret = send_trace_message(&t_msg); } /* API Front-End */ void clacks_trace_string(char *str) { clacks_trace_string_id(str, "NULLID"); } void clacks_trace_string_id(char *str, char *id) { if (str != NULL && id != NULL) { _clacks_trace_string_id(str, id); } } int clacks_new_id(char *id) { if (id == NULL) { return -1; } return get_new_id(id); }
Add forgotten source file cl_test.c
/** * @file cl_trees.c * @author Rastislav Szabo <raszabo@cisco.com>, Lukas Macko <lmacko@cisco.com>, * Milan Lenco <milan.lenco@pantheon.tech> * @brief Iterative tree loading using internal sysrepo requests. * * @copyright * Copyright 2016 Cisco Systems, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "sr_common.h" #include "client_library.h" #include "sysrepo/trees.h" #include "trees_internal.h" sr_node_t * sr_node_get_child(sr_session_ctx_t *session, sr_node_t *node) { int rc = SR_ERR_OK; if (NULL != node) { if (NULL != node->first_child && SR_TREE_ITERATOR_T == node->first_child->type) { rc = sr_get_subtree_next_chunk(session, node); if (SR_ERR_OK != rc) { return NULL; } } return node->first_child; } else { return NULL; } } sr_node_t * sr_node_get_next_sibling(sr_session_ctx_t *session, sr_node_t *node) { int rc = SR_ERR_OK; if (NULL != node) { if (NULL != node->next && SR_TREE_ITERATOR_T == node->next->type) { rc = sr_get_subtree_next_chunk(session, node->parent); if (SR_ERR_OK != rc) { return NULL; } } return node->next; } else { return NULL; } } sr_node_t * sr_node_get_parent(sr_session_ctx_t *session, sr_node_t *node) { (void)session; if (NULL != node) { return node->parent; } else { return NULL; } }
Make this explictly signed. Fixes PR1571.
// RUN: %llvmgcc %s -o - -S -emit-llvm -O3 | grep {i8 signext} // PR1513 struct s{ long a; long b; }; void f(struct s a, char *b, char C) { }
// RUN: %llvmgcc %s -o - -S -emit-llvm -O3 | grep {i8 signext} // PR1513 struct s{ long a; long b; }; void f(struct s a, char *b, signed char C) { }
FIX warnings: newline at end of file
#ifndef _mitk_Video_Source_h_ #define _mitk_Video_Source_h_ #include "mitkCommon.h" #include <itkObject.h> #include "itkObjectFactory.h" namespace mitk { /** * Simple base class for acquiring video data. */ class VideoSource //: public itk::Object { public: //mitkClassMacro( VideoSource, itk::Object ); //itkNewMacro( Self ); VideoSource(); virtual ~VideoSource(); ////##Documentation ////## @brief assigns the grabbing devices for acquiring the next frame. virtual void FetchFrame(); ////##Documentation ////## @brief returns a pointer to the image data array for opengl rendering. virtual unsigned char * GetVideoTexture(); ////##Documentation ////## @brief starts the video capturing. virtual void StartCapturing(); ////##Documentation ////## @brief stops the video capturing. virtual void StopCapturing(); ////##Documentation ////## @brief returns true if video capturing is active. bool IsCapturingEnabled(); protected: unsigned char * m_CurrentVideoTexture; int m_CaptureWidth, m_CaptureHeight; bool m_CapturingInProcess; }; } #endif // Header
#ifndef _mitk_Video_Source_h_ #define _mitk_Video_Source_h_ #include "mitkCommon.h" #include <itkObject.h> #include "itkObjectFactory.h" namespace mitk { /** * Simple base class for acquiring video data. */ class VideoSource //: public itk::Object { public: //mitkClassMacro( VideoSource, itk::Object ); //itkNewMacro( Self ); VideoSource(); virtual ~VideoSource(); ////##Documentation ////## @brief assigns the grabbing devices for acquiring the next frame. virtual void FetchFrame(); ////##Documentation ////## @brief returns a pointer to the image data array for opengl rendering. virtual unsigned char * GetVideoTexture(); ////##Documentation ////## @brief starts the video capturing. virtual void StartCapturing(); ////##Documentation ////## @brief stops the video capturing. virtual void StopCapturing(); ////##Documentation ////## @brief returns true if video capturing is active. bool IsCapturingEnabled(); protected: unsigned char * m_CurrentVideoTexture; int m_CaptureWidth, m_CaptureHeight; bool m_CapturingInProcess; }; } #endif // Header
Add missing include, found by modules build.
//===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_OPTION_OPTSPECIFIER_H #define LLVM_OPTION_OPTSPECIFIER_H namespace llvm { namespace opt { class Option; /// OptSpecifier - Wrapper class for abstracting references to option IDs. class OptSpecifier { unsigned ID; private: explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION; public: OptSpecifier() : ID(0) {} /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {} /*implicit*/ OptSpecifier(const Option *Opt); bool isValid() const { return ID != 0; } unsigned getID() const { return ID; } bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); } bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); } }; } } #endif
//===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_OPTION_OPTSPECIFIER_H #define LLVM_OPTION_OPTSPECIFIER_H #include "llvm/Support/Compiler.h" namespace llvm { namespace opt { class Option; /// OptSpecifier - Wrapper class for abstracting references to option IDs. class OptSpecifier { unsigned ID; private: explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION; public: OptSpecifier() : ID(0) {} /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {} /*implicit*/ OptSpecifier(const Option *Opt); bool isValid() const { return ID != 0; } unsigned getID() const { return ID; } bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); } bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); } }; } } #endif
Add GPIO hal for simulator.
/** * Copyright (c) 2015 Runtime Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "hal/hal_gpio.h" #include <stdio.h> #define HAL_GPIO_NUM_PINS 8 static struct { int val; enum { INPUT, OUTPUT } dir; } hal_gpio[HAL_GPIO_NUM_PINS]; int gpio_init_in(int pin, gpio_pull_t pull) { if (pin >= HAL_GPIO_NUM_PINS) { return -1; } hal_gpio[pin].dir = INPUT; switch (pull) { case GPIO_PULL_UP: hal_gpio[pin].val = 1; break; default: hal_gpio[pin].val = 0; break; } return 0; } int gpio_init_out(int pin, int val) { if (pin >= HAL_GPIO_NUM_PINS) { return -1; } hal_gpio[pin].dir = OUTPUT; hal_gpio[pin].val = (val != 0); return 0; } void gpio_set(int pin) { gpio_write(pin, 1); } void gpio_clear(int pin) { gpio_write(pin, 0); } void gpio_write(int pin, int val) { if (pin >= HAL_GPIO_NUM_PINS) { return; } if (hal_gpio[pin].dir != OUTPUT) { return; } hal_gpio[pin].val = (val != 0); printf("GPIO %d is now %d\n", pin, val); } int gpio_read(int pin) { if (pin >= HAL_GPIO_NUM_PINS) { return -1; } return hal_gpio[pin].val; } void gpio_toggle(int pin) { gpio_write(pin, gpio_read(pin) != 1); }
Disable boost's include_next functionality, fixes compatibility with Sirikata.
/* * LibCassandra * Copyright (C) 2010-2011 Padraig O'Sullivan, Ewen Cheslack-Postava * All rights reserved. * * Use and distribution licensed under the BSD license. See * the COPYING file in the parent directory for full text. */ #ifndef __LIBCASSANDRA_UTIL_PLATFORM_H #define __LIBCASSANDRA_UTIL_PLATFORM_H #include <boost/tr1/memory.hpp> #include <boost/tr1/tuple.hpp> #include <boost/tr1/unordered_map.hpp> #include <string> #include <vector> #include <map> #include <set> #endif //__LIBCASSANDRA_UTIL_PLATFORM_H
/* * LibCassandra * Copyright (C) 2010-2011 Padraig O'Sullivan, Ewen Cheslack-Postava * All rights reserved. * * Use and distribution licensed under the BSD license. See * the COPYING file in the parent directory for full text. */ #ifndef __LIBCASSANDRA_UTIL_PLATFORM_H #define __LIBCASSANDRA_UTIL_PLATFORM_H #ifdef __GNUC__ // #include_next is broken: it does not search default include paths! #define BOOST_TR1_DISABLE_INCLUDE_NEXT // config_all.hpp reads this variable, then sets BOOST_HAS_INCLUDE_NEXT anyway #include <boost/tr1/detail/config_all.hpp> #ifdef BOOST_HAS_INCLUDE_NEXT // This behavior has existed since boost 1.34, unlikely to change. #undef BOOST_HAS_INCLUDE_NEXT #endif #endif #endif #include <boost/tr1/memory.hpp> #include <boost/tr1/tuple.hpp> #include <boost/tr1/unordered_map.hpp> #include <string> #include <vector> #include <map> #include <set> #endif //__LIBCASSANDRA_UTIL_PLATFORM_H
Change integral_constant<bool> to true_type and false_type.
#include <type_traits> template<typename T> struct is_config_type:std::integral_constant<bool,false>{}; template<> struct is_config_type <bool>: std::integral_constant<bool,true>{}; template<> struct is_config_type <int>: std::integral_constant<bool,true>{}; template<> struct is_config_type <long>: std::integral_constant<bool,true>{}; template<> struct is_config_type <long long>: std::integral_constant<bool,true>{}; template<> struct is_config_type <unsigned int>: std::integral_constant<bool,true>{}; template<> struct is_config_type <unsigned long>: std::integral_constant<bool,true>{}; template<> struct is_config_type <unsigned long long>: std::integral_constant<bool,true>{}; template<> struct is_config_type <float>: std::integral_constant<bool,true>{}; template<> struct is_config_type <double>: std::integral_constant<bool,true>{}; template<> struct is_config_type <long double>: std::integral_constant<bool,true>{}; template<> struct is_config_type <std::string>: std::integral_constant<bool,true>{};
#include <type_traits> template<typename T> struct is_config_type: std::false_type{}; template<> struct is_config_type <bool>: std::true_type{}; template<> struct is_config_type <int>: std::true_type{}; template<> struct is_config_type <long>: std::true_type{}; template<> struct is_config_type <long long>: std::true_type{}; template<> struct is_config_type <unsigned int>: std::true_type{}; template<> struct is_config_type <unsigned long>: std::true_type{}; template<> struct is_config_type <unsigned long long>: std::true_type{}; template<> struct is_config_type <float>: std::true_type{}; template<> struct is_config_type <double>: std::true_type{}; template<> struct is_config_type <long double>: std::true_type{}; template<> struct is_config_type <std::string>: std::true_type{};
Update Skia milestone to 96
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 95 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 96 #endif
Update Skia milestone to 67
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 66 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 67 #endif
Remove support for Sun Studio compiler
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SIGAR_VISIBILITY_H #define SIGAR_VISIBILITY_H 1 #ifdef BUILDING_SIGAR #if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) #define SIGAR_PUBLIC_API __global #elif defined __GNUC__ #define SIGAR_PUBLIC_API __attribute__ ((visibility("default"))) #elif defined(_MSC_VER) #define SIGAR_PUBLIC_API __declspec(dllexport) #else /* unknown compiler */ #define SIGAR_PUBLIC_API #endif #else #if defined(_MSC_VER) #define SIGAR_PUBLIC_API __declspec(dllimport) #else #define SIGAR_PUBLIC_API #endif #endif #endif /* SIGAR_VISIBILITY_H */
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #ifdef BUILDING_SIGAR #if defined(__GNUC__) #define SIGAR_PUBLIC_API __attribute__ ((visibility("default"))) #elif defined(_MSC_VER) #define SIGAR_PUBLIC_API __declspec(dllexport) #else /* unknown compiler */ #define SIGAR_PUBLIC_API #endif #else #if defined(_MSC_VER) #define SIGAR_PUBLIC_API __declspec(dllimport) #else #define SIGAR_PUBLIC_API #endif #endif
Use type casts from void
#include "resourceManager.h" #include "kernelHeap.h" //allocates frames MemoryResource *create_memoryResource(unsigned int size) { MemoryResource *memRes; memRes = kmalloc(sizeof(MemoryResource)); return memRes; }
#include "resourceManager.h" #include "kernelHeap.h" //allocates frames MemoryResource *create_memoryResource(unsigned int size) { MemoryResource *memRes; memRes = (MemoryResource*)kmalloc(sizeof(MemoryResource)); return memRes; }
Add functions for linear interpolation of creep function parameters.
#include "matrix.h" #include <stdio.h> enum datacols { _M = 1, _J0 = 2, _J1 = 3, _J2 = 5, _TAU1 = 4, _TAU2 = 6 }; double CreepLookup(char *file, double T, double M, int param) { int i = 0; double M0, M1, y0, y1; matrix *data; data = mtxloadcsv(file, 1); while(val(data, i, _M) < M) i++; M0 = val(data, i-1, _M); M1 = val(data, i, _M); y0 = val(data, i-1, param); y1 = val(data, i, param); DestroyMatrix(data); return y0 + (y1 - y0) * (M-M0)/(M1-M0); } double CreepLookupJ0(char *f, double T, double M) { return CreepLookup(f, T, M, _J0); } double CreepLookupJ1(char *f, double T, double M) { return CreepLookup(f, T, M, _J1); } double CreepLookupJ2(char *f, double T, double M) { return CreepLookup(f, T, M, _J2); } double CreepLookupTau1(char *f, double T, double M) { return CreepLookup(f, T, M, _TAU1); } double CreepLookupTau2(char *f, double T, double M) { return CreepLookup(f, T, M, _TAU2); }
Fix typo in function name
/* stacks.h * Copyright: (When this is determined...it will go here) * CVS Info * $Id$ * Overview: * Stack handling routines for Parrot * Data Structure and Algorithms: * History: * Notes: * References: */ #if !defined(PARROT_STACKS_H_GUARD) #define PARROT_STACKS_H_GUARD #include "parrot/parrot.h" #define STACK_CHUNK_DEPTH 256 struct Stack_Entry { INTVAL entry_type; INTVAL flags; void (*cleanup)(struct Stack_Entry *); union { FLOATVAL num_val; INTVAL int_val; PMC *pmc_val; STRING *string_val; void *generic_pointer; } entry; }; struct Stack { INTVAL used; INTVAL free; struct StackChunk *next; struct StackChunk *prev; struct Stack_Entry entry[STACK_CHUNK_DEPTH]; }; struct Stack_Entry *push_generic_entry(struct Perl_Interp *, void *thing, INTVAL type, void *cleanup); void *pop_generic_entry(struct Perl_Interp *, void *where, INTVAL type); void toss_geleric_entry(struct Perl_Interp *, INTVAL type); #endif /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: nil * End: * * vim: expandtab shiftwidth=4: */
/* stacks.h * Copyright: (When this is determined...it will go here) * CVS Info * $Id$ * Overview: * Stack handling routines for Parrot * Data Structure and Algorithms: * History: * Notes: * References: */ #if !defined(PARROT_STACKS_H_GUARD) #define PARROT_STACKS_H_GUARD #include "parrot/parrot.h" #define STACK_CHUNK_DEPTH 256 struct Stack_Entry { INTVAL entry_type; INTVAL flags; void (*cleanup)(struct Stack_Entry *); union { FLOATVAL num_val; INTVAL int_val; PMC *pmc_val; STRING *string_val; void *generic_pointer; } entry; }; struct Stack { INTVAL used; INTVAL free; struct StackChunk *next; struct StackChunk *prev; struct Stack_Entry entry[STACK_CHUNK_DEPTH]; }; struct Stack_Entry *push_generic_entry(struct Perl_Interp *, void *thing, INTVAL type, void *cleanup); void *pop_generic_entry(struct Perl_Interp *, void *where, INTVAL type); void toss_generic_entry(struct Perl_Interp *, INTVAL type); #endif /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: nil * End: * * vim: expandtab shiftwidth=4: */
Include mysql_com.h has been here for ages but was superfluous
#ifndef MYSQL2_EXT #define MYSQL2_EXT void Init_mysql2(void); /* tell rbx not to use it's caching compat layer by doing this we're making a promise to RBX that we'll never modify the pointers we get back from RSTRING_PTR */ #define RSTRING_NOT_MODIFIED #include <ruby.h> #ifdef HAVE_MYSQL_H #include <mysql.h> #include <mysql_com.h> #include <errmsg.h> #include <mysqld_error.h> #else #include <mysql/mysql.h> #include <mysql/mysql_com.h> #include <mysql/errmsg.h> #include <mysql/mysqld_error.h> #endif #ifdef HAVE_RUBY_ENCODING_H #include <ruby/encoding.h> #endif #ifdef HAVE_RUBY_THREAD_H #include <ruby/thread.h> #endif #if defined(__GNUC__) && (__GNUC__ >= 3) #define RB_MYSQL_NORETURN __attribute__ ((noreturn)) #define RB_MYSQL_UNUSED __attribute__ ((unused)) #else #define RB_MYSQL_NORETURN #define RB_MYSQL_UNUSED #endif #include <client.h> #include <statement.h> #include <result.h> #include <infile.h> #endif
#ifndef MYSQL2_EXT #define MYSQL2_EXT void Init_mysql2(void); /* tell rbx not to use it's caching compat layer by doing this we're making a promise to RBX that we'll never modify the pointers we get back from RSTRING_PTR */ #define RSTRING_NOT_MODIFIED #include <ruby.h> #ifdef HAVE_MYSQL_H #include <mysql.h> #include <errmsg.h> #include <mysqld_error.h> #else #include <mysql/mysql.h> #include <mysql/errmsg.h> #include <mysql/mysqld_error.h> #endif #ifdef HAVE_RUBY_ENCODING_H #include <ruby/encoding.h> #endif #ifdef HAVE_RUBY_THREAD_H #include <ruby/thread.h> #endif #if defined(__GNUC__) && (__GNUC__ >= 3) #define RB_MYSQL_NORETURN __attribute__ ((noreturn)) #define RB_MYSQL_UNUSED __attribute__ ((unused)) #else #define RB_MYSQL_NORETURN #define RB_MYSQL_UNUSED #endif #include <client.h> #include <statement.h> #include <result.h> #include <infile.h> #endif
Check result of write (thans to Alexander Kapshuk <alexander.kapshuk@gmail)
#include "types.h" #include "stat.h" #include "user.h" char buf[512]; void cat(int fd) { int n; while((n = read(fd, buf, sizeof(buf))) > 0) write(1, buf, n); if(n < 0){ printf(1, "cat: read error\n"); exit(); } } int main(int argc, char *argv[]) { int fd, i; if(argc <= 1){ cat(0); exit(); } for(i = 1; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ printf(1, "cat: cannot open %s\n", argv[i]); exit(); } cat(fd); close(fd); } exit(); }
#include "types.h" #include "stat.h" #include "user.h" char buf[512]; void cat(int fd) { int n; while((n = read(fd, buf, sizeof(buf))) > 0) { if (write(1, buf, n) != n) { printf(1, "cat: write error\n"); exit(); } } if(n < 0){ printf(1, "cat: read error\n"); exit(); } } int main(int argc, char *argv[]) { int fd, i; if(argc <= 1){ cat(0); exit(); } for(i = 1; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ printf(1, "cat: cannot open %s\n", argv[i]); exit(); } cat(fd); close(fd); } exit(); }
Fix to literal data types in the macros
#define WORD (8 * sizeof(ulong)) #define clz(x) __builtin_clzl(x) #define fls(x) (WORD - clz(x)) #define ffs(x) (__builtin_ctzl(x)) #define get(x, i) ((x) & (1 << (i))) #define set(x, i) (x = (x) | (1 << (i))) #define unset(x, i) (x = (x) & ~(1 << (i)))
#define WORD (8 * sizeof(ulong)) #define clz(x) __builtin_clzl(x) #define fls(x) (WORD - clz(x)) #define ffs(x) (__builtin_ctzl(x)) #define get(x, i) ((x) & (1L << (i))) #define set(x, i) (x = (x) | (1L << (i))) #define unset(x, i) (x = (x) & ~(1L << (i)))
Add SAFE_RZCALL to wrap calls that returns zero.
#ifndef SAFE_H #define SAFE_H #include "debug.h" #ifndef DISABLE_SAFE #define SAFE_STRINGIFY(x) #x #define SAFE_TOSTRING(x) SAFE_STRINGIFY(x) #define SAFE_AT __FILE__ ":" SAFE_TOSTRING(__LINE__) ": " #define SAFE_ASSERT(cond) do { \ if (!(cond)) { \ DEBUG_DUMP(0, "error: " SAFE_AT "%m"); \ DEBUG_BREAK(!(cond)); \ } \ } while (0) #else #define SAFE_ASSERT(...) #endif #include <stdint.h> #define SAFE_NNCALL(call) do { \ intptr_t ret = (intptr_t) (call); \ SAFE_ASSERT(ret >= 0); \ } while (0) #define SAFE_NZCALL(call) do { \ intptr_t ret = (intptr_t) (call); \ SAFE_ASSERT(ret != 0); \ } while (0) #endif /* end of include guard: SAFE_H */
#ifndef SAFE_H #define SAFE_H #include "debug.h" #ifndef DISABLE_SAFE #define SAFE_STRINGIFY(x) #x #define SAFE_TOSTRING(x) SAFE_STRINGIFY(x) #define SAFE_AT __FILE__ ":" SAFE_TOSTRING(__LINE__) ": " #define SAFE_ASSERT(cond) do { \ if (!(cond)) { \ DEBUG_DUMP(0, "error: " SAFE_AT "%m"); \ DEBUG_BREAK(!(cond)); \ } \ } while (0) #else #define SAFE_ASSERT(...) #endif #include <stdint.h> #define SAFE_NNCALL(call) do { \ intptr_t ret = (intptr_t) (call); \ SAFE_ASSERT(ret >= 0); \ } while (0) #define SAFE_NZCALL(call) do { \ intptr_t ret = (intptr_t) (call); \ SAFE_ASSERT(ret != 0); \ } while (0) #define SAFE_RZCALL(call) do { \ intptr_t ret = (intptr_t) (call); \ SAFE_ASSERT(ret == 0); \ } while (0) #endif /* end of include guard: SAFE_H */
Add proof-of-concept Kernel protocol header.
/** @file Copyright (C) 2016 CupertinoNet. All rights reserved.<BR> 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 DARWIN_KERNEL_H_ #define DARWIN_KERNEL_H_ // Related definitions // DARWIN_KERNEL_IMAGE_TYPE enum { DarwinKernelImageTypeMacho = 0, DarwinKernelImageTypeHibernation = 1 }; typedef UINTN DARWIN_KERNEL_IMAGE_TYPE; // DARWIN_KERNEL_HEADER typedef union { MACH_HEADER *MachHeader; MACH_HEADER_64 *MachHeader64; IO_HIBERNATE_IMAGE_HEADER *HibernationImageHeader; } DARWIN_KERNEL_HEADER; // DARWIN_KERNEL_INFORMATION typedef struct { DARWIN_KERNEL_IMAGE_TYPE ImageType; DARWIN_KERNEL_HEADER Image; } DARWIN_KERNEL_INFORMATION; // DARWIN_KERNEL_DISCOVERED_CALLBACK typedef VOID (EFIAPI *DARWIN_KERNEL_DISCOVERED_CALLBACK)( IN XNU_PHYSICAL_ADDRESS KernelEntry ); // DARWIN_KERNEL_ENTRY_CALLBACK typedef VOID (EFIAPI *DARWIN_KERNEL_ENTRY_CALLBACK)( VOID ); // Protocol definition typedef DARWIN_KERNEL_PROTOCOL DARWIN_KERNEL_PROTOCOL; // DARWIN_KERNEL_ADD_KERNEL_DISCOVERED_CALLBACK typedef EFI_STATUS (EFIAPI *DARWIN_KERNEL_ADD_KERNEL_DISCOVERED_CALLBACK)( IN DARWIN_KERNEL_PROTOCOL *This, IN DARWIN_KERNEL_DISCOVERED_CALLBACK NotifyFunction ); // DARWIN_KERNEL_ADD_KERNEL_ENTRY_CALLBACK typedef EFI_STATUS (EFIAPI *DARWIN_KERNEL_ADD_KERNEL_ENTRY_CALLBACK)( IN DARWIN_KERNEL_PROTOCOL *This, IN DARWIN_KERNEL_ENTRY_CALLBACK NotifyFunction ); // DARWIN_KERNEL_GET_IMAGE_INFORMATION typedef EFI_STATUS (EFIAPI *DARWIN_KERNEL_GET_IMAGE_INFORMATION)( IN DARWIN_KERNEL_PROTOCOL *This, OUT DARWIN_KERNEL_INFORMATION *KernelInformation ); // DARWIN_KERNEL_PROTOCOL struct DARWIN_KERNEL_PROTOCOL { UINTN Revision; DARWIN_KERNEL_ADD_KERNEL_DISCOVERED_CALLBACK AddKernelDiscoveredCallback; DARWIN_KERNEL_ADD_KERNEL_ENTRY_CALLBACK AddKernelEntryCallback; DARWIN_KERNEL_GET_IMAGE_INFORMATION GetImageInformation; }; #endif // DARWIN_KERNEL_H_
Add deadlock non-concurrency example from Kroenig et al ASE16
// PARAM: --set ana.activated[+] deadlock --set ana.activated[+] threadJoins // From https://arxiv.org/abs/1607.06927 #include <pthread.h> int x; pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m3 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m4 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m5 = PTHREAD_MUTEX_INITIALIZER; void func1() { x = 0; // RACE! } int func2(int a) { pthread_mutex_lock(&m5); // TODO NODEADLOCK (thread joined) pthread_mutex_lock(&m4); // TODO NODEADLOCK (thread joined) if (a) x = 3; // NORACE (thread joined) else x = 4; pthread_mutex_unlock(&m4); pthread_mutex_unlock(&m5); return 0; } void *thread() { pthread_mutex_lock(&m1); // NODEADLOCK pthread_mutex_lock(&m2); // TODO NODEADLOCK (common m1) pthread_mutex_lock(&m3); // TODO NODEADLOCK (common m1) x = 1; // NORACE (thread joined) pthread_mutex_unlock(&m3); pthread_mutex_unlock(&m2); pthread_mutex_unlock(&m1); pthread_mutex_lock(&m4); // TODO NODEADLOCK (thread joined) pthread_mutex_lock(&m5); // TODO NODEADLOCK (thread joined) x = 2; // RACE! pthread_mutex_unlock(&m5); pthread_mutex_unlock(&m4); return NULL; } int main() { pthread_t tid; pthread_create(&tid, NULL, thread, NULL); pthread_mutex_lock(&m1); // NODEADLOCK pthread_mutex_lock(&m3); // TODO NODEADLOCK (common m1) pthread_mutex_lock(&m2); // TODO NODEADLOCK (common m1) func1(); pthread_mutex_unlock(&m2); pthread_mutex_unlock(&m3); pthread_mutex_unlock(&m1); pthread_join(tid, NULL); int r; r = func2(5); return 0; }
Add BOTAN_DLL macro to Default_IF_Op
/************************************************* * IF Operations Header File * * (C) 1999-2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_IF_OP_H__ #define BOTAN_IF_OP_H__ #include <botan/bigint.h> #include <botan/pow_mod.h> #include <botan/reducer.h> namespace Botan { /************************************************* * IF Operation * *************************************************/ class BOTAN_DLL IF_Operation { public: virtual BigInt public_op(const BigInt&) const = 0; virtual BigInt private_op(const BigInt&) const = 0; virtual IF_Operation* clone() const = 0; virtual ~IF_Operation() {} }; /************************************************* * Default IF Operation * *************************************************/ class Default_IF_Op : public IF_Operation { public: BigInt public_op(const BigInt& i) const { return powermod_e_n(i); } BigInt private_op(const BigInt&) const; IF_Operation* clone() const { return new Default_IF_Op(*this); } Default_IF_Op(const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&); private: Fixed_Exponent_Power_Mod powermod_e_n, powermod_d1_p, powermod_d2_q; Modular_Reducer reducer; BigInt c, q; }; } #endif
/************************************************* * IF Operations Header File * * (C) 1999-2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_IF_OP_H__ #define BOTAN_IF_OP_H__ #include <botan/bigint.h> #include <botan/pow_mod.h> #include <botan/reducer.h> namespace Botan { /************************************************* * IF Operation * *************************************************/ class BOTAN_DLL IF_Operation { public: virtual BigInt public_op(const BigInt&) const = 0; virtual BigInt private_op(const BigInt&) const = 0; virtual IF_Operation* clone() const = 0; virtual ~IF_Operation() {} }; /************************************************* * Default IF Operation * *************************************************/ class BOTAN_DLL Default_IF_Op : public IF_Operation { public: BigInt public_op(const BigInt& i) const { return powermod_e_n(i); } BigInt private_op(const BigInt&) const; IF_Operation* clone() const { return new Default_IF_Op(*this); } Default_IF_Op(const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&, const BigInt&); private: Fixed_Exponent_Power_Mod powermod_e_n, powermod_d1_p, powermod_d2_q; Modular_Reducer reducer; BigInt c, q; }; } #endif
Remove the last reminints of NBlocks from Projection.
/* -*- mode:linux -*- */ /** * \file projection.h * * * * \author Ethan Burns * \date 2008-10-15 */ #if !defined(_PROJECTION_H_) #define _PROJECTION_H_ #include <vector> #include "../state.h" using namespace std; /** * An abstract projection function class. */ class Projection { public: virtual ~Projection(); /** * Project a state, returning an integer that represents the * NBlock that the state projects into. */ virtual unsigned int project(const State *s) = 0; /** * Get the number of NBlocks that will be used in this * projection. NBlocks will be numbered from 0..num_nblocks() */ virtual unsigned int get_num_nblocks(void) = 0; /** * Get the list of successor NBlock numbers. */ virtual vector<unsigned int>get_successors(const NBlock *b) = 0; /** * Get the list of predecessor NBlock numbers. */ virtual vector<unsigned int>get_predecessors(const NBlock *b) = 0; }; #endif /* !_PROJECTION_H_ */
/* -*- mode:linux -*- */ /** * \file projection.h * * * * \author Ethan Burns * \date 2008-10-15 */ #if !defined(_PROJECTION_H_) #define _PROJECTION_H_ #include <vector> #include "../state.h" using namespace std; /** * An abstract projection function class. */ class Projection { public: virtual ~Projection(); /** * Project a state, returning an integer that represents the * NBlock that the state projects into. */ virtual unsigned int project(const State *s) = 0; /** * Get the number of NBlocks that will be used in this * projection. NBlocks will be numbered from 0..num_nblocks() */ virtual unsigned int get_num_nblocks(void) = 0; /** * Get the list of successor NBlock numbers. */ virtual vector<unsigned int>get_successors(unsigned int b) = 0; /** * Get the list of predecessor NBlock numbers. */ virtual vector<unsigned int>get_predecessors(unsigned int b) = 0; }; #endif /* !_PROJECTION_H_ */
Kill off duplicate kzalloc() definition.
#ifndef __LINUX_SLOB_DEF_H #define __LINUX_SLOB_DEF_H void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) { return kmem_cache_alloc_node(cachep, flags, -1); } void *__kmalloc_node(size_t size, gfp_t flags, int node); static inline void *kmalloc_node(size_t size, gfp_t flags, int node) { return __kmalloc_node(size, flags, node); } /** * kmalloc - allocate memory * @size: how many bytes of memory are required. * @flags: the type of memory to allocate (see kcalloc). * * kmalloc is the normal method of allocating memory * in the kernel. */ static inline void *kmalloc(size_t size, gfp_t flags) { return __kmalloc_node(size, flags, -1); } static inline void *__kmalloc(size_t size, gfp_t flags) { return kmalloc(size, flags); } /** * kzalloc - allocate memory. The memory is set to zero. * @size: how many bytes of memory are required. * @flags: the type of memory to allocate (see kcalloc). */ static inline void *kzalloc(size_t size, gfp_t flags) { return __kzalloc(size, flags); } #endif /* __LINUX_SLOB_DEF_H */
#ifndef __LINUX_SLOB_DEF_H #define __LINUX_SLOB_DEF_H void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) { return kmem_cache_alloc_node(cachep, flags, -1); } void *__kmalloc_node(size_t size, gfp_t flags, int node); static inline void *kmalloc_node(size_t size, gfp_t flags, int node) { return __kmalloc_node(size, flags, node); } /** * kmalloc - allocate memory * @size: how many bytes of memory are required. * @flags: the type of memory to allocate (see kcalloc). * * kmalloc is the normal method of allocating memory * in the kernel. */ static inline void *kmalloc(size_t size, gfp_t flags) { return __kmalloc_node(size, flags, -1); } static inline void *__kmalloc(size_t size, gfp_t flags) { return kmalloc(size, flags); } #endif /* __LINUX_SLOB_DEF_H */
Add carousel to carousel test =P
#include <Elementary.h> #ifdef HAVE_CONFIG_H # include "elementary_config.h" #endif #ifndef ELM_LIB_QUICKLAUNCH void test_carousel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Evas_Object *win, *bg; win = elm_win_add(NULL, "carousel", ELM_WIN_BASIC); elm_win_title_set(win, "Carousel"); elm_win_autodel_set(win, 1); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); evas_object_resize(win, 320, 240); evas_object_show(win); } #endif
#include <Elementary.h> #ifdef HAVE_CONFIG_H # include "elementary_config.h" #endif #ifndef ELM_LIB_QUICKLAUNCH void test_carousel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Evas_Object *win, *bg, *car; win = elm_win_add(NULL, "carousel", ELM_WIN_BASIC); elm_win_title_set(win, "Carousel"); elm_win_autodel_set(win, 1); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); car = elm_carousel_add(win); elm_win_resize_object_add(win, car); evas_object_size_hint_weight_set(car, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_carousel_item_add(car, NULL, "Item 1", NULL, NULL); elm_carousel_item_add(car, NULL, "Item 2", NULL, NULL); elm_carousel_item_add(car, NULL, "Tinga", NULL, NULL); elm_carousel_item_add(car, NULL, "Item 4", NULL, NULL); evas_object_show(car); evas_object_resize(win, 320, 240); evas_object_show(win); } #endif
Test case update for D40873
// RUN: %clang_pgogen -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s void exit(int); int g; __attribute__((noinline)) void foo() { g++; if (g==1000) exit(0); } int main() { while (1) { foo(); } } // CHECK: Counters: // CHECK-NEXT: main: // CHECK-NEXT: Hash: {{.*}} // CHECK-NEXT: Counters: 1 // CHECK-NEXT: Block counts: [1000]
// RUN: %clang_pgogen -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s void exit(int); int g; __attribute__((noinline)) void foo() { g++; if (g==1000) exit(0); } int main() { while (1) { foo(); } } // CHECK: Counters: // CHECK-NEXT: main: // CHECK-NEXT: Hash: {{.*}} // CHECK-NEXT: Counters: 2 // CHECK-NEXT: Block counts: [1000, 1]
Add the thunk test to the suite.
#ifndef end_to_end_tests_remote_h_incl #define end_to_end_tests_remote_h_incl #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> #include "end_to_end_tests_base.h" class EndToEndTestsRemote : public EndToEndTestsBase { static bool is_receiver; CPPUNIT_TEST_SUITE(EndToEndTestsRemote); CPPUNIT_TEST(testRandomBytesReceivedCorrectly); CPPUNIT_TEST(testDefaultIROBOrdering); CPPUNIT_TEST_SUITE_END(); protected: virtual void chooseRole(); virtual bool isReceiver(); void testDefaultIROBOrdering(); void testThunks(); }; #endif
#ifndef end_to_end_tests_remote_h_incl #define end_to_end_tests_remote_h_incl #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> #include "end_to_end_tests_base.h" class EndToEndTestsRemote : public EndToEndTestsBase { static bool is_receiver; CPPUNIT_TEST_SUITE(EndToEndTestsRemote); CPPUNIT_TEST(testRandomBytesReceivedCorrectly); CPPUNIT_TEST(testDefaultIROBOrdering); CPPUNIT_TEST(testThunks); CPPUNIT_TEST_SUITE_END(); protected: virtual void chooseRole(); virtual bool isReceiver(); void testDefaultIROBOrdering(); void testThunks(); }; #endif
Remove unnecessary rounding when allocating initial thread block
/* * Copyright (c) 2012 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <unistd.h> #include "native_client/src/untrusted/nacl/nacl_irt.h" #include "native_client/src/untrusted/nacl/nacl_thread.h" #include "native_client/src/untrusted/nacl/tls.h" /* * This initialization happens early in startup with or without libpthread. * It must make it safe for vanilla newlib code to run. */ void __pthread_initialize_minimal(size_t tdb_size) { /* Adapt size for sbrk. */ /* TODO(robertm): this is somewhat arbitrary - re-examine). */ size_t combined_size = (__nacl_tls_combined_size(tdb_size) + 15) & ~15; /* * Use sbrk not malloc here since the library is not initialized yet. */ void *combined_area = sbrk(combined_size); /* * Fill in that memory with its initializer data. */ void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size); /* * Set %gs, r9, or equivalent platform-specific mechanism. Requires * a syscall since certain bitfields of these registers are trusted. */ nacl_tls_init(tp); /* * Initialize newlib's thread-specific pointer. */ __newlib_thread_init(); }
/* * Copyright (c) 2012 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <unistd.h> #include "native_client/src/untrusted/nacl/nacl_irt.h" #include "native_client/src/untrusted/nacl/nacl_thread.h" #include "native_client/src/untrusted/nacl/tls.h" /* * This initialization happens early in startup with or without libpthread. * It must make it safe for vanilla newlib code to run. */ void __pthread_initialize_minimal(size_t tdb_size) { size_t combined_size = __nacl_tls_combined_size(tdb_size); /* * Use sbrk not malloc here since the library is not initialized yet. */ void *combined_area = sbrk(combined_size); /* * Fill in that memory with its initializer data. */ void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size); /* * Set %gs, r9, or equivalent platform-specific mechanism. Requires * a syscall since certain bitfields of these registers are trusted. */ nacl_tls_init(tp); /* * Initialize newlib's thread-specific pointer. */ __newlib_thread_init(); }
Add private TOC data type
/* toc_private.h - Private optical disc table of contents (TOC) API * * Copyright (c) 2011 Ian Jacobi <pipian@pipian.com> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _LIBCUEIFY_TOC_PRIVATE_H #define _LIBCUEIFY_TOC_PRIVATE_H #include <libcueify/types.h> #define MAX_TRACKS 100 /** Maximum number of tracks on a CD. */ /** Internal structure to hold track data in a TOC. */ typedef struct { /** Sub-Q-channel content format. */ uint8_t adr; /** Track control flags. */ uint8_t control; /** Offset of the start of the track (LBA). */ uint32_t lba; } cueify_toc_track_private; /** Internal structure to hold TOC data. */ typedef struct { /** Number of the first track in the TOC. */ uint8_t first_track_number; /** Number of the last track in the TOC. */ uint8_t last_track_number; /** Tracks in the TOC. */ cueify_toc_track_private tracks[MAX_TRACKS]; } cueify_toc_private; #endif /* _LIBCUEIFY_TOC_PRIVATE_H */
Fix syntax error for linux build.
// For conditions of distribution and use, see copyright notice in license.txt #ifndef incl_KristalliProtocolModuleApi_h #define incl_KristalliProtocolModuleApi_h #if defined (_WINDOWS) #if defined(KRISTALLIPROTOCOL_MODULE_EXPORTS) #define KRISTALLIPROTOCOL_MODULE_API __declspec(dllexport) #else #define KRISTALLIPROTOCOL_MODULE_API __declspec(dllimport) #endif #else #define KRISTALLIPROTOCOL #endif #endif
// For conditions of distribution and use, see copyright notice in license.txt #ifndef incl_KristalliProtocolModuleApi_h #define incl_KristalliProtocolModuleApi_h #if defined (_WINDOWS) #if defined(KRISTALLIPROTOCOL_MODULE_EXPORTS) #define KRISTALLIPROTOCOL_MODULE_API __declspec(dllexport) #else #define KRISTALLIPROTOCOL_MODULE_API __declspec(dllimport) #endif #else #define KRISTALLIPROTOCOL_MODULE_API #endif #endif
Fix the Chrome OS build.
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_ #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_ #pragma once #include "base/observer_list.h" #include "chrome/browser/chromeos/cros/update_library.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { class MockUpdateLibrary : public UpdateLibrary { public: MockUpdateLibrary() {} virtual ~MockUpdateLibrary() {} MOCK_METHOD1(AddObserver, void(Observer*)); // NOLINT MOCK_METHOD1(RemoveObserver, void(Observer*)); // NOLINT MOCK_METHOD0(CheckForUpdate, bool(void)); MOCK_METHOD0(RebootAfterUpdate, bool(void)); MOCK_METHOD1(SetReleaseTrack, bool(const std::string&)); MOCK_METHOD1(GetReleaseTrack, std::string()); MOCK_CONST_METHOD0(status, const Status&(void)); private: DISALLOW_COPY_AND_ASSIGN(MockUpdateLibrary); }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_ #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_ #pragma once #include "base/observer_list.h" #include "chrome/browser/chromeos/cros/update_library.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { class MockUpdateLibrary : public UpdateLibrary { public: MockUpdateLibrary() {} virtual ~MockUpdateLibrary() {} MOCK_METHOD1(AddObserver, void(Observer*)); // NOLINT MOCK_METHOD1(RemoveObserver, void(Observer*)); // NOLINT MOCK_METHOD0(CheckForUpdate, bool(void)); MOCK_METHOD0(RebootAfterUpdate, bool(void)); MOCK_METHOD1(SetReleaseTrack, bool(const std::string&)); MOCK_METHOD0(GetReleaseTrack, std::string()); MOCK_CONST_METHOD0(status, const Status&(void)); private: DISALLOW_COPY_AND_ASSIGN(MockUpdateLibrary); }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_UPDATE_LIBRARY_H_
Change malloc_usable_size for Linux with the __linux__ macro
#ifndef PECTOR_MALLOC_ALLOCATOR_COMPAT_H #define PECTOR_MALLOC_ALLOCATOR_COMPAT_H #ifdef __APPLE__ #include <malloc/malloc.h> #else #include <malloc.h> #endif #if defined __GNUC__ || defined _WIN32 || defined __APPLE__ || defined __FreeBSD__ #define PT_SIZE_AWARE_COMPAT #if defined _WIN32 #define PT_MALLOC_USABLE_SIZE(p) _msize(p) #elif defined __APPLE__ #define PT_MALLOC_USABLE_SIZE(p) malloc_size(p) #elif defined __GNUC__ || defined __FreeBSD__ #define PT_MALLOC_USABLE_SIZE(p) malloc_usable_size(p) #endif #endif // defined __GNUC__ || defined _WIN32 || defined __APPLE__ #endif
#ifndef PECTOR_MALLOC_ALLOCATOR_COMPAT_H #define PECTOR_MALLOC_ALLOCATOR_COMPAT_H #ifdef __APPLE__ #include <malloc/malloc.h> #else #include <malloc.h> #endif #if defined __linux__ || defined __gnu_hurd__ || defined _WIN32 || defined __APPLE__ || defined __FreeBSD__ #define PT_SIZE_AWARE_COMPAT #if defined _WIN32 #define PT_MALLOC_USABLE_SIZE(p) _msize(p) #elif defined __APPLE__ #define PT_MALLOC_USABLE_SIZE(p) malloc_size(p) #elif defined __gnu_hurd__ || __linux__ || defined __FreeBSD__ #define PT_MALLOC_USABLE_SIZE(p) malloc_usable_size(p) #endif #endif // defined __GNUC__ || defined _WIN32 || defined __APPLE__ #endif
Add comment about stack probing and remove unused ifdefs
/* This file is part of ethash. ethash 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. ethash 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 ethash. If not, see <http://www.gnu.org/licenses/>. */ /** @file util.h * @author Tim Hughes <tim@twistedfury.com> * @date 2015 */ #pragma once #include <stdint.h> #include "compiler.h" #ifdef __cplusplus extern "C" { #endif //#ifdef _MSC_VER void debugf(char const* str, ...); //#else //#define debugf printf //#endif static inline uint32_t min_u32(uint32_t a, uint32_t b) { return a < b ? a : b; } static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_) { return x < min_ ? min_ : (x > max_ ? max_ : x); } #ifdef __cplusplus } #endif
/* This file is part of ethash. ethash 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. ethash 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 ethash. If not, see <http://www.gnu.org/licenses/>. */ /** @file util.h * @author Tim Hughes <tim@twistedfury.com> * @date 2015 */ #pragma once #include <stdint.h> #include "compiler.h" #ifdef __cplusplus extern "C" { #endif void debugf(char const* str, ...); static inline uint32_t min_u32(uint32_t a, uint32_t b) { return a < b ? a : b; } static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_) { return x < min_ ? min_ : (x > max_ ? max_ : x); } #ifdef __cplusplus } #endif
Switch to more common timing functions
int test_performance() { asic_t *device = asic_init(TI83p); struct timespec start, stop; unsigned long long t; int i; clock_gettime(CLOCK_MONOTONIC_RAW, &start); for (i = 0; i < 1000000; i++) { i -= cpu_execute(device->cpu, 1); } clock_gettime(CLOCK_MONOTONIC_RAW, &stop); t = (stop.tv_sec*1000000000UL) + stop.tv_nsec; t -= (start.tv_sec * 1000000000UL) + start.tv_nsec; printf("executed 1,000,000 cycles in %llu microseconds (~%llu MHz)\n", t/1000, 1000000000/t); asic_free(device); return -1; }
int test_performance() { asic_t *device = asic_init(TI83p); clock_t start, stop; int i; start = clock(); for (i = 0; i < 1000000; i++) { i -= cpu_execute(device->cpu, 1); } stop = clock(); double time = (double)(stop - start) / (CLOCKS_PER_SEC / 1000); double mHz = 1000.0 / time; printf("executed 1,000,000 cycles in %f milliseconds (~%f MHz)\n", time, mHz); asic_free(device); return -1; }
Add aarch64 jit compiler stub
#include <string.h> #include <math.h> #include <sys/mman.h> #include "expreval_internal.h" static void *create_executable_code_aarch64_linux(const char *machine_code, int size); void *compile_function_internal(compiler c, token first_token, int *size) { unsigned char code[MAX_CODE_LEN]; unsigned char tmp[] = {0x1e, 0x60, 0x28, 0x00, 0xd6, 0x5f, 0x03, 0xc0}; int n = 8; memcpy(code, tmp, n); return create_executable_code_aarch64_linux(code, n); } /* Attraverso opportune chiamate al kernel alloca un vettore della dimensione adatta che contenga il codice appena compilato, vi copia il codice e lo rende eseguibile (avendo cura di renderlo non scrivibile, visto che è bene che la memoria non sia mai scrivibile ed eseguibile nello stesso momento. */ static void *create_executable_code_aarch64_linux(const char *machine_code, int size) { /* Memoria rw- */ void *mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if(mem == MAP_FAILED) return NULL; /* Scrivo il codice */ memcpy(mem, machine_code, size); /* Inibisco la scrittura e consento l'esecuzione (r-x) */ if(mprotect(mem, size, PROT_READ | PROT_EXEC) < 0) { munmap(mem, size); return NULL; } return mem; }
Fix for LLVM API change to SpecialCaseList::create
//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // User-provided blacklist used to disable/alter instrumentation done in // sanitizers. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H #define LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/SpecialCaseList.h" #include <memory> namespace llvm { class GlobalVariable; class Function; class Module; } namespace clang { namespace CodeGen { class SanitizerBlacklist { std::unique_ptr<llvm::SpecialCaseList> SCL; public: SanitizerBlacklist(llvm::SpecialCaseList *SCL) : SCL(SCL) {} bool isIn(const llvm::Module &M, StringRef Category = StringRef()) const; bool isIn(const llvm::Function &F) const; bool isIn(const llvm::GlobalVariable &G, StringRef Category = StringRef()) const; bool isBlacklistedType(StringRef MangledTypeName) const; }; } // end namespace CodeGen } // end namespace clang #endif
//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // User-provided blacklist used to disable/alter instrumentation done in // sanitizers. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H #define LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/SpecialCaseList.h" #include <memory> namespace llvm { class GlobalVariable; class Function; class Module; } namespace clang { namespace CodeGen { class SanitizerBlacklist { std::unique_ptr<llvm::SpecialCaseList> SCL; public: SanitizerBlacklist(std::unique_ptr<llvm::SpecialCaseList> SCL) : SCL(std::move(SCL)) {} bool isIn(const llvm::Module &M, StringRef Category = StringRef()) const; bool isIn(const llvm::Function &F) const; bool isIn(const llvm::GlobalVariable &G, StringRef Category = StringRef()) const; bool isBlacklistedType(StringRef MangledTypeName) const; }; } // end namespace CodeGen } // end namespace clang #endif
Revert "win32: include windef.h instead of windows.h"
/* * This file is part of gspell, a spell-checking library. * * Copyright 2016 - Ignacio Casal Quinteiro <icq@gnome.org> * Copyright 2016 - Sébastien Wilmet <swilmet@gnome.org> * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef GSPELL_INIT_H #define GSPELL_INIT_H #include <glib.h> #ifdef G_OS_WIN32 #include <windef.h> G_GNUC_INTERNAL HMODULE _gspell_init_get_dll (void); #endif /* G_OS_WIN32 */ #endif /* GSPELL_INIT_H */ /* ex:set ts=8 noet: */
/* * This file is part of gspell, a spell-checking library. * * Copyright 2016 - Ignacio Casal Quinteiro <icq@gnome.org> * Copyright 2016 - Sébastien Wilmet <swilmet@gnome.org> * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef GSPELL_INIT_H #define GSPELL_INIT_H #include <glib.h> #ifdef G_OS_WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> G_GNUC_INTERNAL HMODULE _gspell_init_get_dll (void); #endif /* G_OS_WIN32 */ #endif /* GSPELL_INIT_H */ /* ex:set ts=8 noet: */
Remove old tracked point fields
#ifndef TRACKEDPOINT_H #define TRACKEDPOINT_H #include <opencv2/core/affine.hpp> #include "TrackingData.h" namespace sensekit { namespace plugins { namespace hand { struct TrackedPoint { public: cv::Point m_position; cv::Point3f m_worldPosition; cv::Point3f m_steadyWorldPosition; cv::Point3f m_worldDeltaPosition; int m_trackingId; int m_inactiveFrameCount; float m_totalContributionArea; int m_wrongAreaCount; int m_activeFrameCount; TrackedPointType m_type; TrackingStatus m_status; TrackedPoint(cv::Point position, cv::Point3f worldPosition, int trackingId) { m_type = TrackedPointType::CandidatePoint; m_status = TrackingStatus::NotTracking; m_position = position; m_worldPosition = worldPosition; m_steadyWorldPosition = worldPosition; m_worldDeltaPosition = cv::Point3f(0, 0, 0); m_trackingId = trackingId; m_inactiveFrameCount = 0; m_activeFrameCount = 0; m_totalContributionArea = 0; m_wrongAreaCount = 0; } }; }}} #endif // TRACKEDPOINT_H
#ifndef TRACKEDPOINT_H #define TRACKEDPOINT_H #include <opencv2/core/affine.hpp> #include "TrackingData.h" namespace sensekit { namespace plugins { namespace hand { struct TrackedPoint { public: cv::Point m_position; cv::Point3f m_worldPosition; cv::Point3f m_worldDeltaPosition; cv::Point3f m_steadyWorldPosition; int m_trackingId; int m_inactiveFrameCount; int m_activeFrameCount; TrackedPointType m_type; TrackingStatus m_status; TrackedPoint(cv::Point position, cv::Point3f worldPosition, int trackingId) { m_type = TrackedPointType::CandidatePoint; m_status = TrackingStatus::NotTracking; m_position = position; m_worldPosition = worldPosition; m_steadyWorldPosition = worldPosition; m_worldDeltaPosition = cv::Point3f(0, 0, 0); m_trackingId = trackingId; m_inactiveFrameCount = 0; m_activeFrameCount = 0; } }; }}} #endif // TRACKEDPOINT_H