Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add missing file for ARCH = AVR.
/* * RELIC is an Efficient LIbrary for Cryptography * Copyright (C) 2007-2011 RELIC Authors * * This file is part of RELIC. RELIC is legal property of its developers, * whose names are not listed here. Please refer to the COPYRIGHT file * for contact information. * * RELIC is free software; you can redistribute 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. * * RELIC 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 RELIC. If not, see <http://www.gnu.org/licenses/>. */ /** * @file * * Implementation of AVR-dependent routines. * * @version $Id$ * @ingroup arch */ /*============================================================================*/ /* Public definitions */ /*============================================================================*/ void arch_init(void) { } void arch_clean(void) { }
Improve throwsException example to use hasProperty
// OCHamcrest by Jon Reid, http://qualitycoding.org/about/ // Copyright 2015 hamcrest.org. See LICENSE.txt #import <OCHamcrest/HCDiagnosingMatcher.h> /*! * @abstract Does executing a block throw an exception which satisfies a nested matcher? */ @interface HCThrowsException : HCDiagnosingMatcher - (id)initWithExceptionMatcher:(id)exceptionMatcher; @end FOUNDATION_EXPORT id HC_throwsException(id exceptionMatcher); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher that matches when the examined object is a block which, when * executed, throws an exception satisfying the specified matcher. * @param exceptionMatcher The matcher to satisfy when passed the exception. * @discussion * <b>Example</b><br /> * <pre>assertThat(^{ [obj somethingBad]; }, throwsException(anything())</pre> * * <b>Name Clash</b><br /> * In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym * HC_throwsException instead. */ static inline id throwsException(id exceptionMatcher) { return HC_throwsException(exceptionMatcher); } #endif
// OCHamcrest by Jon Reid, http://qualitycoding.org/about/ // Copyright 2015 hamcrest.org. See LICENSE.txt #import <OCHamcrest/HCDiagnosingMatcher.h> /*! * @abstract Does executing a block throw an exception which satisfies a nested matcher? */ @interface HCThrowsException : HCDiagnosingMatcher - (id)initWithExceptionMatcher:(id)exceptionMatcher; @end FOUNDATION_EXPORT id HC_throwsException(id exceptionMatcher); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher that matches when the examined object is a block which, when * executed, throws an exception satisfying the specified matcher. * @param exceptionMatcher The matcher to satisfy when passed the exception. * @discussion * <b>Example</b><br /> * <pre>assertThat(^{ [obj somethingBad]; }, throwsException(hasProperty(@"reason", @"EXPECTED REASON")))</pre> * * <b>Name Clash</b><br /> * In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym * HC_throwsException instead. */ static inline id throwsException(id exceptionMatcher) { return HC_throwsException(exceptionMatcher); } #endif
Hide VDP1 even if FB hasn't been erased and changed
/* * Copyright (c) 2012-2016 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #include <stdlib.h> #include <vdp1.h> #include <vdp2.h> #include <vdp2/tvmd.h> #include <vdp2/vram.h> #include <cons.h> void __noreturn internal_exception_show(const char *buffer) { /* Reset the VDP1 */ vdp1_init(); /* Reset the VDP2 */ vdp2_init(); vdp2_tvmd_display_res_set(TVMD_INTERLACE_NONE, TVMD_HORZ_NORMAL_A, TVMD_VERT_224); vdp2_scrn_back_screen_color_set(VRAM_ADDR_4MBIT(0, 0x01FFFE), COLOR_RGB555(0, 7, 0)); vdp2_tvmd_display_set(); cons_init(CONS_DRIVER_VDP2, 40, 28); cons_buffer(buffer); vdp2_tvmd_vblank_out_wait(); vdp2_tvmd_vblank_in_wait(); vdp2_commit(); cons_flush(); abort(); }
/* * Copyright (c) 2012-2016 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #include <stdlib.h> #include <vdp1.h> #include <vdp2.h> #include <vdp2/tvmd.h> #include <vdp2/vram.h> #include <cons.h> void __noreturn internal_exception_show(const char *buffer) { /* Reset the VDP1 */ vdp1_init(); /* Reset the VDP2 */ vdp2_init(); vdp2_tvmd_display_res_set(TVMD_INTERLACE_NONE, TVMD_HORZ_NORMAL_A, TVMD_VERT_224); vdp2_scrn_back_screen_color_set(VRAM_ADDR_4MBIT(0, 0x01FFFE), COLOR_RGB555(0, 7, 0)); /* Set sprite to type 0 and set its priority to 0 (invisible) */ vdp2_sprite_type_set(0); vdp2_sprite_priority_set(0, 0); vdp2_tvmd_display_set(); cons_init(CONS_DRIVER_VDP2, 40, 28); cons_buffer(buffer); vdp2_tvmd_vblank_out_wait(); vdp2_tvmd_vblank_in_wait(); vdp2_commit(); cons_flush(); abort(); }
Add some spaces and enters
/** Author : Paul TREHIOU & Victor SENE * Date : November 2014 **/ /** * Declaration Point structure * x - real wich is the abscisse of the point * y - real wich is the ordinate of the point */ typedef struct { float x; float y; }Point; /** * Function wich create a point with a specified abscisse and ordinate * abscisse - real * ordinate - real * return a new point */ createPoint(float abscisse, float ordinate); typedef struct pointelem{ Point value; pointelem* next; pointelem* before; }PointElement; typedef PointElement* Polygon;
/** Author : Paul TREHIOU & Victor SENE * Date : November 2014 **/ /** * Declaration Point structure * x - real wich is the abscisse of the point * y - real wich is the ordinate of the point */ typedef struct { float x; float y; }Point; /** * Function wich create a point with a specified abscisse and ordinate * abscisse - real * ordinate - real * return a new point */ createPoint(float abscisse, float ordinate); typedef struct pointelem{ Point value; pointelem* next; pointelem* before; }PointElement; typedef PointElement* Polygon;
Make test a bit more precise.
// RUN: clang-cc -emit-llvm %s -o - | not grep ptrtoint // Make sure we generate something sane instead of a ptrtoint union x {long long b;union x* a;} r = {.a = &r};
// RUN: clang-cc -emit-llvm %s -o - -triple i686-pc-linux-gnu | grep "bitcast (%0\* @r to %union.x\*), \[4 x i8\] zeroinitializer" // Make sure we generate something sane instead of a ptrtoint union x {long long b;union x* a;} r = {.a = &r};
Add BST find min and max value node
#include <stdio.h> #include <stdlib.h> /* This is a code for binary search tree basic implementtion */ //Contains code for PreOrder, InOrder and PostOrder Traversals i.e. Depth First typedef struct node{ int data; struct node* left; struct node* right; } node; node* head; node* create(int data){ node* temp = (node* ) malloc(sizeof(node)); temp->data = data; temp->left = NULL; temp->right = NULL; return temp; } node* insert(node* current, int data){ if(head == NULL){ node* temp; temp = create(data); head = temp; return temp; } else{ if(current == NULL){ node* temp; temp = create(data); return temp; } if(data <= current->data){ current->left = insert(current->left,data); } else if ( data > current->data){ current->right = insert(current->right,data); } } return current; } void print_preorder_all(node* temp){ if(temp != NULL){ printf("data %d ",temp->data); if(temp->left != NULL){ printf("left child %d ",temp->left->data);} else { printf("left child NULL "); } if(temp->right != NULL){ printf("right child %d \n",temp->right->data);} else { printf("right child NULL \n"); } print_preorder_all(temp->left); print_preorder_all(temp->right); } return; } /* Size of tree i.e. number of nodes */ int min_tree(node* root){ node* temp; temp =root; if(temp == NULL ){ return 0; } else{ while (temp->left!=NULL){ temp = temp->left; } return temp->data; } } int max_tree(node* root){ node* temp; temp =root; if(temp == NULL ){ return 0; } else{ while (temp->right!=NULL){ temp = temp->right; } return temp->data; } } int main(){ head = NULL; node* temp; int A[7] = {9,4,15,2,6,12,17}; int i; for(i =0 ; i<7 ; i ++){ temp = insert(head,A[i]); } printf("all info\n"); print_preorder_all(head); printf("\n"); printf("The min of tree is %d \n",min_tree(head)); printf("The max of tree is %d \n",max_tree(head)); return 0; }
Remove some diff file flags
// // GTDiffFile.h // ObjectiveGitFramework // // Created by Danny Greg on 30/11/2012. // Copyright (c) 2012 GitHub, Inc. All rights reserved. // #import "git2.h" // Flags which may be set on the file. // // See diff.h for individual documentation. typedef enum : git_diff_file_flag_t { GTDiffFileFlagValidOID = GIT_DIFF_FILE_VALID_OID, GTDiffFileFlagFreePath = GIT_DIFF_FILE_FREE_PATH, GTDiffFileFlagBinary = GIT_DIFF_FILE_BINARY, GTDiffFileFlagNotBinary = GIT_DIFF_FILE_NOT_BINARY, GTDiffFileFlagFreeData = GIT_DIFF_FILE_FREE_DATA, GTDiffFileFlagUnmapData = GIT_DIFF_FILE_UNMAP_DATA, GTDiffFileFlagNoData = GIT_DIFF_FILE_NO_DATA, } GTDiffFileFlag; // A class representing a file on one side of a diff. @interface GTDiffFile : NSObject // The location within the working directory of the file. @property (nonatomic, readonly, copy) NSString *path; // The size (in bytes) of the file. @property (nonatomic, readonly) NSUInteger size; // Any flags set on the file (see `GTDiffFileFlag` for more info). @property (nonatomic, readonly) GTDiffFileFlag flags; // The mode of the file. @property (nonatomic, readonly) mode_t mode; // Designated initialiser. - (instancetype)initWithGitDiffFile:(git_diff_file)file; @end
// // GTDiffFile.h // ObjectiveGitFramework // // Created by Danny Greg on 30/11/2012. // Copyright (c) 2012 GitHub, Inc. All rights reserved. // #import "git2.h" // Flags which may be set on the file. // // See diff.h for individual documentation. typedef enum : git_diff_flag_t { GTDiffFileFlagValidOID = GIT_DIFF_FLAG_VALID_OID, GTDiffFileFlagBinary = GIT_DIFF_FLAG_BINARY, GTDiffFileFlagNotBinary = GIT_DIFF_FLAG_NOT_BINARY, } GTDiffFileFlag; // A class representing a file on one side of a diff. @interface GTDiffFile : NSObject // The location within the working directory of the file. @property (nonatomic, readonly, copy) NSString *path; // The size (in bytes) of the file. @property (nonatomic, readonly) NSUInteger size; // Any flags set on the file (see `GTDiffFileFlag` for more info). @property (nonatomic, readonly) GTDiffFileFlag flags; // The mode of the file. @property (nonatomic, readonly) mode_t mode; // Designated initialiser. - (instancetype)initWithGitDiffFile:(git_diff_file)file; @end
Add EventSystem shim missed in r588.
#ifndef EVENT_SYSTEM_H #define EVENT_SYSTEM_H #include <event/event_thread.h> /* * XXX * This is kind of an awful shim while we move * towards something thread-oriented. */ class EventSystem { EventThread td_; private: EventSystem(void) : td_() { } ~EventSystem() { } public: Action *poll(const EventPoll::Type& type, int fd, EventCallback *cb) { return (td_.poll(type, fd, cb)); } Action *register_interest(const EventInterest& interest, Callback *cb) { return (td_.register_interest(interest, cb)); } Action *schedule(Callback *cb) { return (td_.schedule(cb)); } Action *timeout(unsigned ms, Callback *cb) { return (td_.timeout(ms, cb)); } void start(void) { td_.start(); td_.join(); } static EventSystem *instance(void) { static EventSystem *instance; if (instance == NULL) instance = new EventSystem(); return (instance); } }; #endif /* !EVENT_SYSTEM_H */
Add move-only type for testing/benchmarking.
/* * The MIT License (MIT) * * Copyright (c) 2015 Morwenn * * 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. */ #include <stdexcept> #include <utility> //////////////////////////////////////////////////////////// // Move-only type for benchmarks // // std::sort and std::stable_sort are supposed to be able to // sort collections of types that are move-only and that are // not default-constructible. The class template move_only // wraps such a type and can be fed to algorithms to check // whether they still compile. // // Additionally, move_only detects attempts to read the value // after a move has been performed and throws an exceptions // when it happens. // template<typename T> struct move_only { // Not default-constructible move_only() = delete; // Move-only move_only(const move_only&) = delete; move_only& operator=(const move_only&) = delete; // Can be constructed from a T for convenience move_only(const T& value): can_read(true), value(value) {} // Move operators move_only(move_only&& other): can_read(true), value(std::move(other.value)) { if (not std::exchange(other.can_read, false)) { throw std::logic_error("illegal read from a moved-from value"); } } auto operator=(move_only&& other) -> move_only& { if (&other != this) { if (not std::exchange(other.can_read, false)) { throw std::logic_error("illegal read from a moved-from value"); } can_read = true; value = std::move(other.value); } return *this; } // Whether the value can be read bool can_read = false; // Actual value T value; }; template<typename T> auto operator<(const move_only<T>& lhs, const move_only<T>& rhs) -> bool { return lhs.value < rhs.value; }
Add copy-pasted stub for future RequestContext
// Copyright (c) 2015 Yandex LLC. All rights reserved. // Author: Vasily Chekalkin <bacek@yandex-team.ru> #ifndef SDCH_REQUEST_CONTEXT_H_ #define SDCH_REQUEST_CONTEXT_H_ extern "C" { #include <ngx_config.h> #include <nginx.h> #include <ngx_core.h> #include <ngx_http.h> } namespace sdch { class Handler; // Context used inside nginx to keep relevant data. struct RequestContext { ngx_http_request_t *request; ngx_chain_t *in; ngx_chain_t *free; ngx_chain_t *busy; ngx_chain_t *out; ngx_chain_t **last_out; ngx_chain_t *copied; ngx_chain_t *copy_buf; ngx_buf_t *in_buf; ngx_buf_t *out_buf; ngx_int_t bufs; struct sdch_dict *dict; struct sdch_dict fdict; unsigned started:1; unsigned flush:4; unsigned redo:1; unsigned done:1; unsigned nomem:1; unsigned buffering:1; unsigned store:1; size_t zin; size_t zout; z_stream zstream; struct sv *stuc; }; private: }; } // namespace sdch #endif // SDCH_REQUEST_CONTEXT_H_
Add ppc_function_entry() which gets the entry point for a function
#ifndef _ASM_POWERPC_CODE_PATCHING_H #define _ASM_POWERPC_CODE_PATCHING_H /* * Copyright 2008, Michael Ellerman, IBM Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ /* Flags for create_branch: * "b" == create_branch(addr, target, 0); * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE); * "bl" == create_branch(addr, target, BRANCH_SET_LINK); * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK); */ #define BRANCH_SET_LINK 0x1 #define BRANCH_ABSOLUTE 0x2 unsigned int create_branch(const unsigned int *addr, unsigned long target, int flags); void patch_branch(unsigned int *addr, unsigned long target, int flags); void patch_instruction(unsigned int *addr, unsigned int instr); #endif /* _ASM_POWERPC_CODE_PATCHING_H */
#ifndef _ASM_POWERPC_CODE_PATCHING_H #define _ASM_POWERPC_CODE_PATCHING_H /* * Copyright 2008, Michael Ellerman, IBM Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <asm/types.h> /* Flags for create_branch: * "b" == create_branch(addr, target, 0); * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE); * "bl" == create_branch(addr, target, BRANCH_SET_LINK); * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK); */ #define BRANCH_SET_LINK 0x1 #define BRANCH_ABSOLUTE 0x2 unsigned int create_branch(const unsigned int *addr, unsigned long target, int flags); void patch_branch(unsigned int *addr, unsigned long target, int flags); void patch_instruction(unsigned int *addr, unsigned int instr); static inline unsigned long ppc_function_entry(void *func) { #ifdef CONFIG_PPC64 /* * On PPC64 the function pointer actually points to the function's * descriptor. The first entry in the descriptor is the address * of the function text. */ return ((func_descr_t *)func)->entry; #else return (unsigned long)func; #endif } #endif /* _ASM_POWERPC_CODE_PATCHING_H */
Add POSIX files, yay. Almost fixes compile
/** * \file socket.c - Windows Socket Abstractions * * Copyright (c) 2015 Michael Casadevall * * 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. **/ #define __FTL_INTERNAL #include "ftl.h" #include <unistd.h> void ftl_init_sockets() { //BSD sockets are smarter and don't need silly init } int ftl_close_socket(int sock) { return close(sock); } char * ftl_get_socket_error() { return strerror(errno); }
Allow intrusive pointers to const objects.
#include "ug_thread_safe_counter.h" #pragma once // obsolete once intrusive_ref_counter is available everywhere namespace Moses { class reference_counter { public: friend void intrusive_ptr_add_ref(reference_counter* p) { if (p) ++p->m_refcount; } friend void intrusive_ptr_release(reference_counter* p) { if (p && --p->m_refcount == 0) delete p; } protected: reference_counter() {} virtual ~reference_counter() {}; private: mutable ThreadSafeCounter m_refcount; }; }
#include "ug_thread_safe_counter.h" #pragma once // obsolete once intrusive_ref_counter is available everywhere namespace Moses { class reference_counter { public: friend void intrusive_ptr_add_ref(reference_counter const* p) { if (p) ++p->m_refcount; } friend void intrusive_ptr_release(reference_counter const* p) { if (p && --p->m_refcount == 0) delete p; } protected: reference_counter() {} virtual ~reference_counter() {}; private: mutable ThreadSafeCounter m_refcount; }; }
Rename test suite version of debug to match the header.
#include "log.h" #include <stdio.h> #include <stdarg.h> void debug(const char* format, ...) { #ifdef __DEBUG__ va_list args; va_start(args, format); vprintf(format, args); va_end(args); #endif // __DEBUG__ } void initializeLogging() { }
#include "log.h" #include <stdio.h> #include <stdarg.h> void debugNoNewline(const char* format, ...) { #ifdef __DEBUG__ va_list args; va_start(args, format); vprintf(format, args); va_end(args); #endif // __DEBUG__ } void initializeLogging() { }
Add MEMCPY and MEMCPY_N macros
#ifndef UTIL_H #define UTIL_H /*** Utility functions ***/ #define ALLOC(type) ALLOC_N(type, 1) #define ALLOC_N(type, n) ((type*) xmalloc(sizeof(type) * (n))) void *xmalloc(size_t); char *hextoa(const char *, int); #define STARTS_WITH(x, y) (strncmp((x), (y), strlen(y)) == 0) #endif /* UTIL_H */
#ifndef UTIL_H #define UTIL_H /*** Utility functions ***/ #define ALLOC(type) ALLOC_N(type, 1) #define ALLOC_N(type, n) ((type*) xmalloc(sizeof(type) * (n))) #define MEMCPY(dst, src, type) MEMCPY_N(dst, src, type, 1) #define MEMCPY_N(dst, src, type, n) (memcpy((dst), (src), sizeof(type) * (n))) void *xmalloc(size_t); char *hextoa(const char *, int); #define STARTS_WITH(x, y) (strncmp((x), (y), strlen(y)) == 0) #endif /* UTIL_H */
Revert "powerpc/mm: Bump SECTION_SIZE_BITS from 16MB to 256MB"
#ifndef _ASM_POWERPC_SPARSEMEM_H #define _ASM_POWERPC_SPARSEMEM_H 1 #ifdef __KERNEL__ #ifdef CONFIG_SPARSEMEM /* * SECTION_SIZE_BITS 2^N: how big each section will be * MAX_PHYSADDR_BITS 2^N: how much physical address space we have * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space */ #define SECTION_SIZE_BITS 28 #define MAX_PHYSADDR_BITS 44 #define MAX_PHYSMEM_BITS 44 #endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_MEMORY_HOTPLUG extern void create_section_mapping(unsigned long start, unsigned long end); extern int remove_section_mapping(unsigned long start, unsigned long end); #ifdef CONFIG_NUMA extern int hot_add_scn_to_nid(unsigned long scn_addr); #else static inline int hot_add_scn_to_nid(unsigned long scn_addr) { return 0; } #endif /* CONFIG_NUMA */ #endif /* CONFIG_MEMORY_HOTPLUG */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_SPARSEMEM_H */
#ifndef _ASM_POWERPC_SPARSEMEM_H #define _ASM_POWERPC_SPARSEMEM_H 1 #ifdef __KERNEL__ #ifdef CONFIG_SPARSEMEM /* * SECTION_SIZE_BITS 2^N: how big each section will be * MAX_PHYSADDR_BITS 2^N: how much physical address space we have * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space */ #define SECTION_SIZE_BITS 24 #define MAX_PHYSADDR_BITS 44 #define MAX_PHYSMEM_BITS 44 #endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_MEMORY_HOTPLUG extern void create_section_mapping(unsigned long start, unsigned long end); extern int remove_section_mapping(unsigned long start, unsigned long end); #ifdef CONFIG_NUMA extern int hot_add_scn_to_nid(unsigned long scn_addr); #else static inline int hot_add_scn_to_nid(unsigned long scn_addr) { return 0; } #endif /* CONFIG_NUMA */ #endif /* CONFIG_MEMORY_HOTPLUG */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_SPARSEMEM_H */
Add compatibility header and use compatibility macros to enable builds on both R13 and R14.
#ifndef ERL_NIF_COMPAT_H_ #define ERL_NIF_COMPAT_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "erl_nif.h" #if ERL_NIF_MAJOR_VERSION == 1 && ERL_NIF_MINOR_VERSION == 0 #define enif_open_resource_type_compat enif_open_resource_type #define enif_alloc_resource_compat enif_alloc_resource #define enif_release_resource_compat enif_release_resource #define enif_alloc_binary_compat enif_alloc_binary #define enif_realloc_binary_compat enif_realloc_binary #define enif_release_binary_compat enif_release_binary #define enif_alloc_compat enif_alloc #define enif_free_compat enif_free #define enif_get_atom_compat(E, T, B, S, C) \ enif_get_atom(E, T, B, S) #endif /* R13B04 */ #if ERL_NIF_MAJOR_VERSION == 2 && ERL_NIF_MINOR_VERSION == 0 #define enif_open_resource_type_compat(E, N, D, F, T) \ enif_open_resource_type(E, NULL, N, D, F, T) #define enif_alloc_resource_compat(E, T, S) \ enif_alloc_resource(T, S) #define enif_release_resource_compat(E, H) \ enif_release_resource(H) #define enif_alloc_binary_compat(E, S, B) \ enif_alloc_binary(S, B) #define enif_realloc_binary_compat(E, B, S) \ enif_realloc_binary(B, S) #define enif_release_binary_compat(E, B) \ enif_release_binary(B) #define enif_alloc_compat(E, S) \ enif_alloc(S) #define enif_free_compat(E, P) \ enif_free(P) #define enif_get_atom_compat enif_get_atom #endif /* R14 */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* ERL_NIF_COMPAT_H_ */
Update relative path of includes
#ifndef GAMEMODEWIDGET_H #define GAMEMODEWIDGET_H #include <QtWidgets> #include "PlayerActivatedWidget.h" #include "PlayerControlModeWidget.h" #include "Game\Player.h" #include "Game\State.h" class GameModeWidget : public QWidget { public: GameModeWidget(QWidget * parent = 0); ~GameModeWidget(); Player currentPlayer()const; State currentMode()const; protected: private: PlayerActivatedWidget * m_player1Indicator, *m_player2Indicator; PlayerControlModeWidget * m_playerControlAngle, * m_playerControlPower, * m_playerControlFire; public slots: void setCurrentMode(State gameMode); void setCurrentPlayer(Player player); }; #endif
#ifndef GAMEMODEWIDGET_H #define GAMEMODEWIDGET_H #include <QtWidgets> #include "PlayerActivatedWidget.h" #include "PlayerControlModeWidget.h" #include "Game/Player.h" #include "Game/State.h" class GameModeWidget : public QWidget { public: GameModeWidget(QWidget * parent = 0); ~GameModeWidget(); Player currentPlayer()const; State currentMode()const; protected: private: PlayerActivatedWidget * m_player1Indicator, *m_player2Indicator; PlayerControlModeWidget * m_playerControlAngle, * m_playerControlPower, * m_playerControlFire; public slots: void setCurrentMode(State gameMode); void setCurrentPlayer(Player player); }; #endif
Add the h2o/httparser.h forgotten on previous commit
/* * Copyright (c) 2016 Domingo Alvarez Duarte * * The software is licensed under either the MIT License (below) or the Perl * license. * * 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 HTTPPARSER_H #define HTTPPARSER_H #include "picohttpparser.h" #endif // HTTPPARSER_H
Add VIEWS_EXPORT to autoscroll constants.
// 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 VIEWS_VIEW_CONSTANTS_H_ #define VIEWS_VIEW_CONSTANTS_H_ #pragma once #include "views/views_export.h" namespace views { // Size (width or height) within which the user can hold the mouse and the // view should scroll. extern const int kAutoscrollSize; // Time in milliseconds to autoscroll by a row. This is used during drag and // drop. extern const int kAutoscrollRowTimerMS; // Used to determine whether a drop is on an item or before/after it. If a drop // occurs kDropBetweenPixels from the top/bottom it is considered before/after // the item, otherwise it is on the item. VIEWS_EXPORT extern const int kDropBetweenPixels; } // namespace views #endif // VIEWS_VIEW_CONSTANTS_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 VIEWS_VIEW_CONSTANTS_H_ #define VIEWS_VIEW_CONSTANTS_H_ #pragma once #include "views/views_export.h" namespace views { // Size (width or height) within which the user can hold the mouse and the // view should scroll. VIEWS_EXPORT extern const int kAutoscrollSize; // Time in milliseconds to autoscroll by a row. This is used during drag and // drop. VIEWS_EXPORT extern const int kAutoscrollRowTimerMS; // Used to determine whether a drop is on an item or before/after it. If a drop // occurs kDropBetweenPixels from the top/bottom it is considered before/after // the item, otherwise it is on the item. VIEWS_EXPORT extern const int kDropBetweenPixels; } // namespace views #endif // VIEWS_VIEW_CONSTANTS_H_
Make US100 sensor get distance successfully.
/*==============================================================================================*/ /*==============================================================================================*/ #include "QuadCopterConfig.h" Ultrasonic_t Ultrasonic = { .lenHigh = 0, .lenLow = 0, .d = 0 }; /*==============================================================================================*/ /*==============================================================================================* **函數 : us100_distant **功能 : get 1 calculated distant data from the data received by USART **輸入 : Ultrasonic.lenHigh, Ultrasonic.lenLow **輸出 : Ultrasonic.d (mm) **使用 : us100_distant(); **==============================================================================================*/ /*==============================================================================================*/ void us100_distant(){ //reading data serial.putc('U'); serial2.putc('1'); //vTaskDelay(500); //calculating the distance //if(serial2.getc()){ Ultrasonic.lenHigh = serial.getc(); serial2.putc('2'); Ultrasonic.lenLow = serial.getc(); serial2.putc('3'); Ultrasonic.d = Ultrasonic.lenHigh*256 + Ultrasonic.lenLow; //} }
/*==============================================================================================*/ /*==============================================================================================*/ #include "QuadCopterConfig.h" /* Connection methods of Ultrasonic */ #define ULT_USE_UART2 1 #define ULT_USE_PWM 0 Ultrasonic_t Ultrasonic = { .lenHigh = 0, .lenLow = 0, .d = 0 }; /*==============================================================================================*/ /*==============================================================================================* **函數 : us100_distant **功能 : get 1 calculated distant data from the data received by USART **輸入 : Ultrasonic.lenHigh, Ultrasonic.lenLow **輸出 : Ultrasonic.d (mm) **使用 : print_us100_distant(); **==============================================================================================*/ /*==============================================================================================*/ void print_us100_distant(){ #if ULT_USE_UART2 serial2.putc('U'); vTaskDelay(500); Ultrasonic.lenHigh = serial2.getc(); Ultrasonic.lenLow = serial2.getc(); Ultrasonic.d = (Ultrasonic.lenHigh*256 + Ultrasonic.lenLow)*0.1; serial.printf("Distance: "); serial.printf("%d",Ultrasonic.d); serial.printf(" cm\n\r"); vTaskDelay(30); #endif }
Change date of copyright notice
#ifndef MAP_PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H #define MAP_PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H /* * * Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U * * This file is part of Orion Context Broker. * * Orion Context Broker is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Orion Context Broker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero * General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. * * For those usages not covered by this license please contact with * fermin at tid dot es * * Author: TID Developer */ #include "convenience/UpdateContextAttributeRequest.h" #include "mongoBackend/MongoGlobal.h" /* **************************************************************************** * * mapPutIndividualContextEntityAttributes - */ extern HttpStatusCode mapPutIndividualContextEntityAttribute(std::string entityId, std::string attributeName, UpdateContextAttributeRequest* request, StatusCode* response); #endif
#ifndef MAP_PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H #define MAP_PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H /* * * Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U * * This file is part of Orion Context Broker. * * Orion Context Broker is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Orion Context Broker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero * General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. * * For those usages not covered by this license please contact with * fermin at tid dot es * * Author: TID Developer */ #include "convenience/UpdateContextAttributeRequest.h" #include "mongoBackend/MongoGlobal.h" /* **************************************************************************** * * mapPutIndividualContextEntityAttributes - */ extern HttpStatusCode mapPutIndividualContextEntityAttribute(std::string entityId, std::string attributeName, UpdateContextAttributeRequest* request, StatusCode* response); #endif
Enable debug helpers only on debug builds.
#ifndef INLINE_DEBUG_HELPER_H #define INLINE_DEBUG_HELPER_H #include "pipe/p_compiler.h" #include "util/u_debug.h" /* Helper function to wrap a screen with * one or more debug driver: rbug, trace. */ #ifdef GALLIUM_TRACE #include "trace/tr_public.h" #endif #ifdef GALLIUM_RBUG #include "rbug/rbug_public.h" #endif #ifdef GALLIUM_GALAHAD #include "galahad/glhd_public.h" #endif #ifdef GALLIUM_NOOP #include "noop/noop_public.h" #endif static INLINE struct pipe_screen * debug_screen_wrap(struct pipe_screen *screen) { #if defined(GALLIUM_RBUG) screen = rbug_screen_create(screen); #endif #if defined(GALLIUM_TRACE) screen = trace_screen_create(screen); #endif #if defined(GALLIUM_GALAHAD) screen = galahad_screen_create(screen); #endif #if defined(GALLIUM_NOOP) screen = noop_screen_create(screen); #endif return screen; } #endif
#ifndef INLINE_DEBUG_HELPER_H #define INLINE_DEBUG_HELPER_H #include "pipe/p_compiler.h" #include "util/u_debug.h" /* Helper function to wrap a screen with * one or more debug driver: rbug, trace. */ #ifdef DEBUG #ifdef GALLIUM_TRACE #include "trace/tr_public.h" #endif #ifdef GALLIUM_RBUG #include "rbug/rbug_public.h" #endif #ifdef GALLIUM_GALAHAD #include "galahad/glhd_public.h" #endif #ifdef GALLIUM_NOOP #include "noop/noop_public.h" #endif #endif /* DEBUG */ static INLINE struct pipe_screen * debug_screen_wrap(struct pipe_screen *screen) { #ifdef DEBUG #if defined(GALLIUM_RBUG) screen = rbug_screen_create(screen); #endif #if defined(GALLIUM_TRACE) screen = trace_screen_create(screen); #endif #if defined(GALLIUM_GALAHAD) screen = galahad_screen_create(screen); #endif #if defined(GALLIUM_NOOP) screen = noop_screen_create(screen); #endif #endif /* DEBUG */ return screen; } #endif
Use : as separator between "GM" and slide name in SampleApp. This makes it easier to jump to a GM slide using command line args on windows.
/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GMSampleView_DEFINED #define GMSampleView_DEFINED #include "SampleCode.h" #include "gm.h" class GMSampleView : public SampleView { private: typedef skiagm::GM GM; public: GMSampleView(GM* gm) : fGM(gm) {} virtual ~GMSampleView() { delete fGM; } protected: virtual bool onQuery(SkEvent* evt) { if (SampleCode::TitleQ(*evt)) { SkString name("GM "); name.append(fGM->shortName()); SampleCode::TitleR(evt, name.c_str()); return true; } return this->INHERITED::onQuery(evt); } virtual void onDrawContent(SkCanvas* canvas) { fGM->drawContent(canvas); } virtual void onDrawBackground(SkCanvas* canvas) { fGM->drawBackground(canvas); } private: GM* fGM; typedef SampleView INHERITED; }; #endif
/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GMSampleView_DEFINED #define GMSampleView_DEFINED #include "SampleCode.h" #include "gm.h" class GMSampleView : public SampleView { private: typedef skiagm::GM GM; public: GMSampleView(GM* gm) : fGM(gm) {} virtual ~GMSampleView() { delete fGM; } protected: virtual bool onQuery(SkEvent* evt) { if (SampleCode::TitleQ(*evt)) { SkString name("GM:"); name.append(fGM->shortName()); SampleCode::TitleR(evt, name.c_str()); return true; } return this->INHERITED::onQuery(evt); } virtual void onDrawContent(SkCanvas* canvas) { fGM->drawContent(canvas); } virtual void onDrawBackground(SkCanvas* canvas) { fGM->drawBackground(canvas); } private: GM* fGM; typedef SampleView INHERITED; }; #endif
Set default value of StaticMeshComponent::mesh to nullptr
#pragma once #include "pathos/actor/scene_component.h" #include "badger/types/matrix_types.h" namespace pathos { class Mesh; class MeshGeometry; class Material; // #todo-renderer: Further decompose struct StaticMeshProxy : public SceneComponentProxy { uint32 doubleSided : 1; uint32 renderInternal : 1; matrix4 modelMatrix; MeshGeometry* geometry; Material* material; }; struct ShadowMeshProxy : public SceneComponentProxy { matrix4 modelMatrix; MeshGeometry* geometry; }; class StaticMeshComponent : public SceneComponent { friend class GodRay; // due to createRenderProxy_internal() public: virtual void createRenderProxy(Scene* scene); inline Mesh* getStaticMesh() const { return mesh; } void setStaticMesh(Mesh* inMesh) { mesh = inMesh; } private: void createRenderProxy_internal(Scene* scene, std::vector<StaticMeshProxy*>& outProxyList); public: bool castsShadow = true; private: Mesh* mesh; }; }
#pragma once #include "pathos/actor/scene_component.h" #include "badger/types/matrix_types.h" namespace pathos { class Mesh; class MeshGeometry; class Material; // #todo-renderer: Further decompose struct StaticMeshProxy : public SceneComponentProxy { uint32 doubleSided : 1; uint32 renderInternal : 1; matrix4 modelMatrix; MeshGeometry* geometry; Material* material; }; struct ShadowMeshProxy : public SceneComponentProxy { matrix4 modelMatrix; MeshGeometry* geometry; }; class StaticMeshComponent : public SceneComponent { friend class GodRay; // due to createRenderProxy_internal() public: virtual void createRenderProxy(Scene* scene); inline Mesh* getStaticMesh() const { return mesh; } void setStaticMesh(Mesh* inMesh) { mesh = inMesh; } private: void createRenderProxy_internal(Scene* scene, std::vector<StaticMeshProxy*>& outProxyList); public: bool castsShadow = true; private: Mesh* mesh = nullptr; }; }
Update code for generated asm analysis
/* * Copyright (c) 2017-2022, Patrick Pelissier * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * + Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * + 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. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS AND 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. */ #include "m-string.h" size_t fsize(const char str[]) { return m_str1ng_utf8_length(str); } void convert(string_t s, unsigned n) { m_string_set_ui(s, n); }
/* * Copyright (c) 2017-2022, Patrick Pelissier * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * + Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * + 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. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS AND 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. */ #include "m-string.h" size_t fsize(const char str[]) { return m_str1ng_utf8_length(str); } void convert(string_t s, unsigned n) { m_string_set_ui(s, n); } void construct(char s[], unsigned n) { strcpy(s, M_CSTR("Hello %u worlds")); }
Comment improvement: explain consequences of using ZLocationCell
// // ZDetailKit.h // // Created by Lukas Zeller on 15.02.13. // Copyright (c) 2013 plan44.ch. All rights reserved. // // common #import "ZDetailEditing.h" #import "ZDBGMacros.h" // ZUtils #import "ZCustomI8n.h" // controllers #import "ZDetailTableViewController.h" // cells #import "ZButtonCell.h" #import "ZSwitchCell.h" #import "ZSegmentChoicesCell.h" #import "ZSliderCell.h" #import "ZTextFieldCell.h" #import "ZTextViewCell.h" #import "ZDateTimeCell.h" #import "ZColorChooserCell.h" #import "ZChoiceListCell.h" // Note: ZLocationCell requires MapKit and CoreLocation frameworks to be included in the app #import "ZLocationCell.h" // EOF
// // ZDetailKit.h // // Created by Lukas Zeller on 15.02.13. // Copyright (c) 2013 plan44.ch. All rights reserved. // // common #import "ZDetailEditing.h" #import "ZDBGMacros.h" // ZUtils #import "ZCustomI8n.h" // controllers #import "ZDetailTableViewController.h" // cells #import "ZButtonCell.h" #import "ZSwitchCell.h" #import "ZSegmentChoicesCell.h" #import "ZSliderCell.h" #import "ZTextFieldCell.h" #import "ZTextViewCell.h" #import "ZDateTimeCell.h" #import "ZColorChooserCell.h" #import "ZChoiceListCell.h" // Note: ZLocationCell requires MapKit and CoreLocation frameworks to be included in the app, // which in turn requires that the app declares usage of location in NSLocationAlwaysUsageDescription, // NSLocationWhenInUseUsageDescription, and NSLocationAlwaysAndWhenInUseUsageDescription in info.plist #import "ZLocationCell.h" // EOF
Add example of how to select Japan country
// project-specific definitions for otaa sensor //#define CFG_eu868 1 #define CFG_us915 1 //#define CFG_au921 1 //#define CFG_as923 1 //#define CFG_in866 1 #define CFG_sx1276_radio 1 //#define LMIC_USE_INTERRUPTS
// project-specific definitions //#define CFG_eu868 1 #define CFG_us915 1 //#define CFG_au921 1 //#define CFG_as923 1 // #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP /* for as923-JP */ //#define CFG_in866 1 #define CFG_sx1276_radio 1 //#define LMIC_USE_INTERRUPTS
Add comments suit for formatting with idiom
#include "../libk.h" void screenTest(void) { int rows, cols; rows = glob.rows; cols = glob.cols; printf("%s", CursorToTopLeft ClearScreen );fflush(stdout); printf("Top of Screen: rows = %d cols = %d\n\r", rows,cols);fflush(stdout); int count; for (count = 2; count < rows; count ++) {printf("%s", TildeReturnNewline); fflush(stdout);} printf("%s","Bottom of Screen "); fflush(stdout); // Force Cursor Position with <ESC>[{ROW};{COLUMN}f printf ("\x1b[%d;%df%s", 5,5,"Hello World"); fflush(stdout); // printf("\x1b[%d;%df",2,1); fflush(stdout); return; }
#include "../libk.h" // function screenTest void screenTest(void) { // retrieve Screen rows and columns from struct glob int rows, cols; rows = glob.rows; cols = glob.cols; // Move Screen Cursor to Top Left, Then Clear Screen printf("%s", CursorToTopLeft ClearScreen );fflush(stdout); // Print the Screen Header printf("Top of Screen: rows = %d cols = %d\n\r", rows,cols);fflush(stdout); int count; // Print Left Column Tildes to Screen, leaving screen last line clear for (count = 2; count < rows; count ++) {printf("%s", TildeReturnNewline); fflush(stdout);} // Prnt Screen Last Line printf("%s","Bottom of Screen "); fflush(stdout); // Place Cursor Position with <ESC>[{ROW};{COLUMN}f printf ("\x1b[%d;%df%s", 5,5,"Hello World"); fflush(stdout); // Move Screen Cursor to Second Line, First Column printf("\x1b[%d;%df",2,1); fflush(stdout); return; }
Fix knode superkaramba compilation on NetBSD. Patch by Mark Davies. BUG: 154730
#ifndef LMSENSOR_H #define LMSENSOR_H #include <K3Process> #include <K3ProcIO> #include "sensor.h" /** * * Hans Karlsson **/ class SensorSensor : public Sensor { Q_OBJECT public: SensorSensor(int interval, char tempUnit); ~SensorSensor(); void update(); private: K3ShellProcess ksp; QString extraParams; QMap<QString, QString> sensorMap; #ifdef __FreeBSD__ QMap<QString, QString> sensorMapBSD; #endif QString sensorResult; private slots: void receivedStdout(K3Process *, char *buffer, int); void processExited(K3Process *); }; #endif // LMSENSOR_H
#ifndef LMSENSOR_H #define LMSENSOR_H #include <K3Process> #include <K3ProcIO> #include "sensor.h" /** * * Hans Karlsson **/ class SensorSensor : public Sensor { Q_OBJECT public: SensorSensor(int interval, char tempUnit); ~SensorSensor(); void update(); private: K3ShellProcess ksp; QString extraParams; QMap<QString, QString> sensorMap; #if defined(__FreeBSD__) || defined(Q_OS_NETBSD) QMap<QString, QString> sensorMapBSD; #endif QString sensorResult; private slots: void receivedStdout(K3Process *, char *buffer, int); void processExited(K3Process *); }; #endif // LMSENSOR_H
Fix return value of main().
int x = 0; int main(int argc, char *argv[]) { int y; char *p = &x; *p = 23; y = x; x = 35; return y; }
int x = 0; int main(int argc, char *argv[]) { int y; char *p = &x; *p = 23; y = x; x = 35; return y != 23; }
Rearrange output operator declarations in tests to make old OSX clang happy
#pragma once #include <TestFramework/TestFramework.h> #include <cal3d/streamops.h> #include <cal3d/vector4.h> #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> #include <boost/lexical_cast.hpp> #include <boost/scoped_array.hpp> using boost::scoped_ptr; using boost::shared_ptr; using boost::lexical_cast; using boost::scoped_array; inline bool AreClose( const CalPoint4& p1, const CalPoint4& p2, float tolerance ) { return (p1.asCalVector4() - p2.asCalVector4()).length() < tolerance; }
#pragma once // The old version of clang currently used on the Mac builder requires some // operator<<() declarations to precede their use in the UnitTest++ // templates/macros. -- jlee - 2014-11-21 #include <cal3d/streamops.h> #include <TestFramework/TestFramework.h> #include <cal3d/vector4.h> #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> #include <boost/lexical_cast.hpp> #include <boost/scoped_array.hpp> using boost::scoped_ptr; using boost::shared_ptr; using boost::lexical_cast; using boost::scoped_array; inline bool AreClose( const CalPoint4& p1, const CalPoint4& p2, float tolerance ) { return (p1.asCalVector4() - p2.asCalVector4()).length() < tolerance; }
Make Networking run on the main thread.
/* Copyright 2011 Future Platforms 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 <KirinKit/KirinKit.h> #import "Networking.h" @interface NetworkingBackend : KirinServiceStub <Networking> { } @end
/* Copyright 2011 Future Platforms 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 <KirinKit/KirinKit.h> #import "Networking.h" @interface NetworkingBackend : KirinServiceStub <Networking, KirinServiceOnMainThread> { } @end
Add `nonnull` and `nullable` attributes
// // EYMaskedTextField.h // // // Created by Evgeniy Yurtaev on 10/09/15. // Copyright (c) 2015 Evgeniy Yurtaev. All rights reserved. // #import <UIKit/UIKit.h> @protocol EYMaskedTextFieldDelegate <UITextFieldDelegate> @optional - (BOOL)textField:(UITextField *)textField shouldChangeUnformattedText:(NSString *)unformattedText inRange:(NSRange)range replacementString:(NSString *)string; @end @interface EYMaskedTextField : UITextField @property (copy, nonatomic) IBInspectable NSString *mask; @property (copy, nonatomic) IBInspectable NSString *unformattedText; @property (assign, nonatomic) id<EYMaskedTextFieldDelegate> delegate; @end
// // EYMaskedTextField.h // // // Created by Evgeniy Yurtaev on 10/09/15. // Copyright (c) 2015 Evgeniy Yurtaev. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @protocol EYMaskedTextFieldDelegate <UITextFieldDelegate> @optional - (BOOL)textField:(nonnull UITextField *)textField shouldChangeUnformattedText:(nullable NSString *)unformattedText inRange:(NSRange)range replacementString:(nullable NSString *)string; @end @interface EYMaskedTextField : UITextField @property (copy, nonatomic, nullable) IBInspectable NSString *mask; @property (copy, nonatomic, nullable) IBInspectable NSString *unformattedText; @property (assign, nonatomic, nullable) id<EYMaskedTextFieldDelegate> delegate; @end NS_ASSUME_NONNULL_END
Remove _constantwidth as there are other was to determine that via the length of the _width_data vector
#pragma once #include <ri.h> #include <vector> #include "Types.h" typedef std::vector<RtInt> RtIntContainer; typedef std::vector<RtFloat> RtFloatContainer; /*! * \remark Alembic does not support "holes" but to be safe, we are targeting * RiPointsGeneralPolygons to future proof our code * * RtVoid RiPointsGeneralPolygons(RtInt npolys, RtInt nloops[], * RtInt nvertices[], * RtInt vertices[], ...); * */ struct RendermanMeshData { V3fSamplingArray2D _P_data_array; // Assumes topological stability RtInt _npolys; RtIntContainer _nloops_data; RtIntContainer _nvertices_data; RtIntContainer _vertices_data; }; struct RendermanPointsData { V3fSamplingArray2D _P_data_array; // Assumes topological stability RtFloat _constantwidth; RtIntContainer _ids_data; RtFloatContainer _width_data; }; // == Emacs ================ // ------------------------- // Local variables: // tab-width: 4 // indent-tabs-mode: t // c-basic-offset: 4 // end: // // == vi =================== // ------------------------- // Format block // ex:ts=4:sw=4:expandtab // -------------------------
#pragma once #include <ri.h> #include <vector> #include "Types.h" typedef std::vector<RtInt> RtIntContainer; typedef std::vector<RtFloat> RtFloatContainer; /*! * \remark Alembic does not support "holes" but to be safe, we are targeting * RiPointsGeneralPolygons to future proof our code * * RtVoid RiPointsGeneralPolygons(RtInt npolys, RtInt nloops[], * RtInt nvertices[], * RtInt vertices[], ...); * */ struct RendermanMeshData { V3fSamplingArray2D _P_data_array; // Assumes topological stability RtInt _npolys; RtIntContainer _nloops_data; RtIntContainer _nvertices_data; RtIntContainer _vertices_data; }; struct RendermanPointsData { V3fSamplingArray2D _P_data_array; // Assumes topological stability RtIntContainer _ids_data; RtFloatContainer _width_data; }; // == Emacs ================ // ------------------------- // Local variables: // tab-width: 4 // indent-tabs-mode: t // c-basic-offset: 4 // end: // // == vi =================== // ------------------------- // Format block // ex:ts=4:sw=4:expandtab // -------------------------
Fix detection of lib if we use `-Werror`
/** * @file * * @brief tests if compilation works (include and build paths set correct, etc...) * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) * */ #include <gcrypt.h> int main (void) { gcry_cipher_hd_t elektraCryptoHandle; return 0; }
/** * @file * * @brief tests if compilation works (include and build paths set correct, etc...) * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) * */ #include <gcrypt.h> gcry_cipher_hd_t nothing () { gcry_cipher_hd_t elektraCryptoHandle = NULL; return elektraCryptoHandle; } int main (void) { nothing (); return 0; }
Fix unintentional tentative definitions that result in duplicate symbol definitions when building with -fno-common
/* * 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 java_lang_Thread_H #define java_lang_Thread_H #import <pthread.h> @class JavaLangThread; CF_EXTERN_C_BEGIN pthread_key_t java_thread_key; pthread_once_t java_thread_key_init_once; void initJavaThreadKeyOnce(); JavaLangThread *getCurrentJavaThreadOrNull(); CF_EXTERN_C_END #endif // java_lang_Thread_H
/* * 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 java_lang_Thread_H #define java_lang_Thread_H #import <pthread.h> @class JavaLangThread; CF_EXTERN_C_BEGIN extern pthread_key_t java_thread_key; extern pthread_once_t java_thread_key_init_once; void initJavaThreadKeyOnce(); JavaLangThread *getCurrentJavaThreadOrNull(); CF_EXTERN_C_END #endif // java_lang_Thread_H
Add new file to umbrella import.
// // WebApiClient-Core.h // WebApiClient // // Created by Matt on 21/07/15. // Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #import <WebApiClient/FileWebApiResource.h> #import <WebApiClient/NSDictionary+WebApiClient.h> #import <WebApiClient/WebApiAuthorizationProvider.h> #import <WebApiClient/WebApiClient.h> #import <WebApiClient/WebApiClientEnvironment.h> #import <WebApiClient/WebApiClientSupport.h> #import <WebApiClient/WebApiDataMapper.h> #import <WebApiClient/WebApiResource.h> #import <WebApiClient/WebApiResponse.h> #import <WebApiClient/WebApiRoute.h>
// // WebApiClient-Core.h // WebApiClient // // Created by Matt on 21/07/15. // Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #import <WebApiClient/FileWebApiResource.h> #import <WebApiClient/NSDictionary+WebApiClient.h> #import <WebApiClient/WebApiAuthorizationProvider.h> #import <WebApiClient/WebApiClient.h> #import <WebApiClient/WebApiClientDigestUtils.h> #import <WebApiClient/WebApiClientEnvironment.h> #import <WebApiClient/WebApiClientSupport.h> #import <WebApiClient/WebApiDataMapper.h> #import <WebApiClient/WebApiResource.h> #import <WebApiClient/WebApiResponse.h> #import <WebApiClient/WebApiRoute.h>
Add portable floating point printing with optional grisu3 support
#ifndef PPRINTFP_H #define PPRINTFP_H /* * Grisu3 is not part of the portable lib per se, it must be in the * include path. Grisu3 provides much faster printing and parsing in the * typical case with fallback to sprintf for printing and strod for * parsing. * * Either define PORTABLE_USE_GRISU3, or include the grisu3 header first. * * Without grisu3, this file still ensures that a float or a double is * printed without loss of precision. */ #if PORTABLE_USE_GRISU3 #include "grisu3/grisu3_print.h" #endif #ifdef grisu3_print_double_is_defined /* Currently there is not special support for floats. */ #define print_float(n, p) grisu3_print_double((float)(n), (p)) #define print_double(n, p) grisu3_print_double((double)(n), (p)) #else #include <stdio.h> #define print_float(n, p) sprintf(p, "%.9g", (float)(n)) #define print_double(n, p) sprintf(p, "%.17g", (double)(n)) #endif #define print_hex_float(n, p) sprintf(p, "%a", (float)(n)) #define print_hex_double(n, p) sprintf(p, "%a", (double)(n)) #endif /* PPRINTFP_H */
Add a class for the settings dialog
#pragma once #define CLASS_3RVX L"3RVXv3" static const UINT WM_3RVX_CONTROL = RegisterWindowMessage(L"WM_3RVX_CONTROL"); static const UINT WM_3RVX_SETTINGSCTRL = RegisterWindowMessage(L"WM_3RVX_SETTINGSCTRL"); #define MSG_LOAD WM_APP + 100 #define MSG_SETTINGS WM_APP + 101 #define MSG_EXIT WM_APP + 102 #define MSG_HIDEOSD WM_APP + 103
#pragma once #define CLASS_3RVX L"3RVXv3" #define CLASS_3RVX_SETTINGS L"3RVX-Settings" static const UINT WM_3RVX_CONTROL = RegisterWindowMessage(L"WM_3RVX_CONTROL"); static const UINT WM_3RVX_SETTINGSCTRL = RegisterWindowMessage(L"WM_3RVX_SETTINGSCTRL"); #define MSG_LOAD WM_APP + 100 #define MSG_SETTINGS WM_APP + 101 #define MSG_EXIT WM_APP + 102 #define MSG_HIDEOSD WM_APP + 103 #define MSG_ACTIVATE WM_APP + 104
Fix ChromeOS build (C99 break)
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /****************************************************************** iLBC Speech Coder ANSI-C Source Code WebRtcIlbcfix_NearestNeighbor.c ******************************************************************/ #include "defines.h" void WebRtcIlbcfix_NearestNeighbor(size_t* index, const size_t* array, size_t value, size_t arlength) { size_t min_diff = (size_t)-1; for (size_t i = 0; i < arlength; i++) { const size_t diff = (array[i] < value) ? (value - array[i]) : (array[i] - value); if (diff < min_diff) { *index = i; min_diff = diff; } } }
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /****************************************************************** iLBC Speech Coder ANSI-C Source Code WebRtcIlbcfix_NearestNeighbor.c ******************************************************************/ #include "defines.h" void WebRtcIlbcfix_NearestNeighbor(size_t* index, const size_t* array, size_t value, size_t arlength) { size_t i; size_t min_diff = (size_t)-1; for (i = 0; i < arlength; i++) { const size_t diff = (array[i] < value) ? (value - array[i]) : (array[i] - value); if (diff < min_diff) { *index = i; min_diff = diff; } } }
Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows
// RUN: rm -rf %t && mkdir -p %t && cd %t // RUN: not --crash %clang_cc1 %s -emit-llvm -o foo.ll // RUN: ls . | FileCheck %s --allow-empty // CHECK-NOT: foo.ll #pragma clang __debug crash FOO
Add some color for console output
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H #define KAI_PLATFORM_GAME_CONTROLLER_H #include KAI_PLATFORM_INCLUDE(GameController.h) #endif // SHATTER_PLATFORM_GAME_CONTROLLER_H //EOF
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H #define KAI_PLATFORM_GAME_CONTROLLER_H #include KAI_PLATFORM_INCLUDE(GameController.h) #endif //EOF
Add supplemental __clzhi2, __ctzhi2, for old MSPGCC
/* * Copyright (C) 2016 Eistec AB * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup cpu * @{ * * @file * @brief MSPGCC supplemental functions * * @author Joakim Nohlgård <joakim.nohlgard@eistec.se * * @} */ #ifdef __MSPGCC__ /* internal GCC type for "half integer" (16 bit) */ /* See also: * http://stackoverflow.com/questions/4559025/what-does-gcc-attribute-modexx-actually-do * http://www.delorie.com/gnu/docs/gcc/gccint_53.html */ typedef unsigned int UHItype __attribute__ ((mode (HI))); /** * @brief Count leading zeros * * Naive implementation */ int __clzhi2(UHItype x) { int i = 0; for (UHItype mask = (1 << 15); mask != 0; mask >>= 1) { if (x & mask) { return i; } ++i; } return i; /* returns 16 if x == 0 */ } /** * @brief Count trailing zeros * * Naive implementation */ int __ctzhi2(UHItype x) { int i = 0; for (UHItype mask = 1; mask != 0; mask <<= 1) { if (x & mask) { return i; } ++i; } return i; /* returns 16 if x == 0 */ } #endif /* __MSPGCC__ */
Make function inline and noexcept.
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/document/bucket/bucketid.h> #include <vespa/persistence/spi/bucket_limits.h> #include <cassert> namespace storage { /** * Returns the super bucket key of the given bucket id key based on the minimum used bits allowed. */ uint64_t get_super_bucket_key(const document::BucketId& bucket_id) { assert(bucket_id.getUsedBits() >= spi::BucketLimits::MinUsedBits); // Since bucket keys have count-bits at the LSB positions, we want to look at the MSBs instead. return (bucket_id.toKey() >> (64 - spi::BucketLimits::MinUsedBits)); } }
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/document/bucket/bucketid.h> #include <vespa/persistence/spi/bucket_limits.h> #include <cassert> namespace storage { /** * Returns the super bucket key of the given bucket id key based on the minimum used bits allowed. */ inline uint64_t get_super_bucket_key(const document::BucketId& bucket_id) noexcept { assert(bucket_id.getUsedBits() >= spi::BucketLimits::MinUsedBits); // Since bucket keys have count-bits at the LSB positions, we want to look at the MSBs instead. return (bucket_id.toKey() >> (64 - spi::BucketLimits::MinUsedBits)); } }
Implement the actual utility. Only does key to phrase conversion at the moment.
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "constants.h" #include "funcs.h" int main(int argc, char **argv) { if (argc != 2) { return printf("usage: %s [hex key] [key phrase]\n", argv[0]); } char *wordlist[NUMWORDS]; FILE *fp = fopen(WORDFILE, "r"); if (!fp) { printf("Could not find wordlist: '%s' is missing!", WORDFILE); return 1; } for(int i=0; i < NUMWORDS; i++) { wordlist[i] = malloc(WORDLENGTH + 1); fgets(wordlist[i], WORDLENGTH + 1, fp); for (int j=strlen(wordlist[i])-1; j>=0 && (wordlist[i][j] == '\n' || wordlist[i][j]=='\r'); j--) { wordlist[i][j]='\0'; } } if (is_hex(argv[1])) { char hex[normalized_hex_string_length(argv[1])]; normalize_hex_string(hex, argv[1]); char phrase[max_phrase_length(hex)]; get_phrase(phrase, hex, wordlist); printf("%s\n", phrase); for (int i=0; i < NUMWORDS; i++) { free(wordlist[i]); } } else { printf("TBD\n"); } }
Add a library to provide CHECK and friends.
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0` #ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_ #define OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_ #include <stdbool.h> #include "sw/device/lib/base/log.h" #include "sw/device/lib/runtime/abort.h" /** * Runtime assertion macros with log.h integration. */ /** * Checks that the given condition is true. If the condition is false, this * function logs and then aborts. * * @param condition an expression to check. * @param ... arguments to a LOG_* macro, which are evaluated if the check * fails. */ #define CHECK(condition, ...) \ do { \ if (!(condition)) { \ LOG_ERROR("CHECK-fail: " __VA_ARGS__); \ abort(); \ } \ } while (false) /** * Shorthand for CHECK(value == 0). * * @param condition a value to check. * @param ... arguments to a LOG_* macro, which are evaluated if the check * fails. */ #define CHECKZ(value, ...) CHECK((value) == 0, ...) #endif // OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
Add testcase for last llvm-gcc tweaks
// RUN: %llvmgcc -S %s -emit-llvm -o - | grep "signext" | count 4 signed char foo1() { return 1; } void foo2(signed short a) { } signed char foo3(void) { return 1; } void foo4(a) signed short a; { }
Fix typo: "Pythong" -> "Python" ;-)
// Filename: p3dReferenceCount.h // Created by: drose (09Jul09) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef P3DREFERENCECOUNT_H #define P3DREFERENCECOUNT_H #include "p3d_plugin_common.h" //////////////////////////////////////////////////////////////////// // Class : P3DReferenceCount // Description : A base class for reference-counted objects in this // module. We follow the Panda convention, rather than // the Pythong convention: the reference count of a new // object is initially 0. //////////////////////////////////////////////////////////////////// class P3DReferenceCount { public: inline P3DReferenceCount(); inline ~P3DReferenceCount(); inline void ref() const; inline bool unref() const; private: int _ref_count; }; template<class RefCountType> inline void unref_delete(RefCountType *ptr); #include "p3dReferenceCount.I" #endif
// Filename: p3dReferenceCount.h // Created by: drose (09Jul09) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef P3DREFERENCECOUNT_H #define P3DREFERENCECOUNT_H #include "p3d_plugin_common.h" //////////////////////////////////////////////////////////////////// // Class : P3DReferenceCount // Description : A base class for reference-counted objects in this // module. We follow the Panda convention, rather than // the Python convention: the reference count of a new // object is initially 0. //////////////////////////////////////////////////////////////////// class P3DReferenceCount { public: inline P3DReferenceCount(); inline ~P3DReferenceCount(); inline void ref() const; inline bool unref() const; private: int _ref_count; }; template<class RefCountType> inline void unref_delete(RefCountType *ptr); #include "p3dReferenceCount.I" #endif
Fix printing bug in node-counter pass
#pragma once #include "bpftrace.h" #include "log.h" #include "pass_manager.h" #include "visitors.h" namespace bpftrace { namespace ast { class NodeCounter : public Visitor { public: void Visit(Node &node) { count_++; Visitor::Visit(node); } size_t get_count() { return count_; }; private: size_t count_ = 0; }; Pass CreateCounterPass() { auto fn = [](Node &n, PassContext &ctx) { NodeCounter c; c.Visit(n); auto node_count = c.get_count(); auto max = ctx.b.ast_max_nodes_; if (bt_verbose) { LOG(INFO) << "node count: " << max; } if (node_count >= max) { LOG(ERROR) << "node count (" << node_count << ") exceeds the limit (" << max << ")"; return PassResult::Error("node count exceeded"); } return PassResult::Success(); }; return Pass("NodeCounter", fn); } } // namespace ast } // namespace bpftrace
#pragma once #include "bpftrace.h" #include "log.h" #include "pass_manager.h" #include "visitors.h" namespace bpftrace { namespace ast { class NodeCounter : public Visitor { public: void Visit(Node &node) { count_++; Visitor::Visit(node); } size_t get_count() { return count_; }; private: size_t count_ = 0; }; Pass CreateCounterPass() { auto fn = [](Node &n, PassContext &ctx) { NodeCounter c; c.Visit(n); auto node_count = c.get_count(); auto max = ctx.b.ast_max_nodes_; if (bt_verbose) { LOG(INFO) << "node count: " << node_count; } if (node_count >= max) { LOG(ERROR) << "node count (" << node_count << ") exceeds the limit (" << max << ")"; return PassResult::Error("node count exceeded"); } return PassResult::Success(); }; return Pass("NodeCounter", fn); } } // namespace ast } // namespace bpftrace
Exclude data store from controller code coverage.
#pragma once #ifndef YOU_CONTROLLER_TESTS_EXCLUSIONS_H_ #define YOU_CONTROLLER_TESTS_EXCLUSIONS_H_ // A local define since there is no way to test whether a header file exists. // If you have VS Premium, then add it to the project definition (user // properties) file #ifdef MS_CPP_CODECOVERAGE /// \file Exclusions from code coverage analysis. /// See http://msdn.microsoft.com/en-sg/library/dd537628.aspx #include <CodeCoverage/CodeCoverage.h> #pragma managed(push, off) ExcludeFromCodeCoverage(boost, L"boost::*"); ExcludeFromCodeCoverage(boost_meta, L"??@*@"); ExcludeFromCodeCoverage(You_NLP, L"You::NLP::*"); ExcludeFromCodeCoverage(You_QueryEngine, L"You::QueryEngine::*"); ExcludeFromCodeCoverage(You_Utils, L"You::Utils::*"); #pragma managed(pop) #endif // MS_CPP_CODECOVERAGE #endif // YOU_CONTROLLER_TESTS_EXCLUSIONS_H_
#pragma once #ifndef YOU_CONTROLLER_TESTS_EXCLUSIONS_H_ #define YOU_CONTROLLER_TESTS_EXCLUSIONS_H_ // A local define since there is no way to test whether a header file exists. // If you have VS Premium, then add it to the project definition (user // properties) file #ifdef MS_CPP_CODECOVERAGE /// \file Exclusions from code coverage analysis. /// See http://msdn.microsoft.com/en-sg/library/dd537628.aspx #include <CodeCoverage/CodeCoverage.h> #pragma managed(push, off) ExcludeFromCodeCoverage(boost, L"boost::*"); ExcludeFromCodeCoverage(boost_meta, L"??@*@"); ExcludeFromCodeCoverage(You_NLP, L"You::NLP::*"); ExcludeFromCodeCoverage(You_QueryEngine, L"You::QueryEngine::*"); ExcludeFromCodeCoverage(You_DataStore, L"You::DataStore::*"); ExcludeFromCodeCoverage(You_Utils, L"You::Utils::*"); #pragma managed(pop) #endif // MS_CPP_CODECOVERAGE #endif // YOU_CONTROLLER_TESTS_EXCLUSIONS_H_
Add wrapper to stop reinclude of library headers
// Wrapper to prevent multiple imports #ifndef LIBHDHOMERUN_H #define LIBHDHOMERUN_H #import "hdhomerun_os.h" #import "hdhomerun_discover.h" #import "hdhomerun_pkt.h" #endif
Change Plugin methods to static
#pragma once #include "begin_code.h" namespace _internal { /// This is just an empty class. /// Most wrapper class regard this class as a friend class. /// You can get/set raw pointers through this class. class Plugin { public: template<typename T> decltype(auto) get(const T& obj) { return obj._get(); } template<typename T,typename U> void set(T& obj,U&& value) { obj._set(value); } template<typename T> void clear(T& obj) { obj._clear(); } template<typename T,typename U> void set_no_delete(T& obj,U&& value) { obj._set_no_delete(value); } }; } #include "end_code.h"
#pragma once #include "begin_code.h" namespace _internal { /// This is just an empty class. /// Most wrapper class regard this class as a friend class. /// You can get/set raw pointers through this class. class Plugin { public: template<typename T> static decltype(auto) get(const T& obj) { return obj._get(); } template<typename T,typename U> static void set(T& obj,U&& value) { obj._set(value); } template<typename T> static void clear(T& obj) { obj._clear(); } template<typename T,typename U> static void set_no_delete(T& obj,U&& value) { obj._set_no_delete(value); } }; } #include "end_code.h"
Disable some compiler warnings on the boost library.
// Copyright (c) 2009-2011 Turbulenz Limited // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #ifdef _MSC_VER #pragma once #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #ifndef BOOST_DISABLE_THREADS #define BOOST_DISABLE_THREADS #endif #include <boost/xpressive/xpressive.hpp> #include <stdio.h> #include <math.h> #include <float.h> #include <limits.h> #include <string.h> #include <stdlib.h> #include <string> #include <list> #include <map> #include <set> #include <Cg/cg.h> #include <Cg/cgGL.h>
// Copyright (c) 2009-2011 Turbulenz Limited // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #ifdef _MSC_VER #pragma once #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #ifndef BOOST_DISABLE_THREADS #define BOOST_DISABLE_THREADS #endif #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable:4458) # pragma warning(disable:4459) # pragma warning(disable:4456) #endif #include <boost/xpressive/xpressive.hpp> #ifdef _MSC_VER # pragma warning(pop) #endif #include <stdio.h> #include <math.h> #include <float.h> #include <limits.h> #include <string.h> #include <stdlib.h> #include <string> #include <list> #include <map> #include <set> #include <Cg/cg.h> #include <Cg/cgGL.h>
Structure to hold header information for dat that should be written to file.
#ifndef ALIHLTPHOSDATAHEADERSTRUCT_H #define ALIHLTPHOSDATAHEADERSTRUCT_H #include "AliHLTDataTypes.h" struct AliHLTPHOSDataHeaderStruct { AliHLTUInt32_t fSize; /**<Total size of datablock in bytes, incuding the header*/ AliHLTComponentDataType fDataType; /**<Data type stored in this file */ AliHLTUInt32_t fEventID; /**<The HLT internal event ID for this event */ AliHLTUInt32_t fAlgorithm; /**<Wich algorithm was uses estimate cellenergies*/ AliHLTUInt32_t fFormatVersion; /**<Header format version, currently 1*/ AliHLTUInt32_t fFutureUse0; AliHLTUInt32_t fFutureUse1; AliHLTUInt32_t fFutureUse2; }; #endif
Remove unnecessary lib include check
/* vl53l0x_types.h - Zephyr customization of ST vl53l0x library, * basic type definition. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ #define ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ /* Zephyr provides stdint.h and stddef.h, so this is enough to include it. * If it was not the case, we would defined here all signed and unsigned * basic types... */ #include <stdint.h> #include <stddef.h> #ifndef NULL #error "Error NULL definition should be done. Please add required include " #endif #if !defined(STDINT_H) && !defined(_GCC_STDINT_H) && !defined(__STDINT_DECLS) \ && !defined(_GCC_WRAP_STDINT_H) && !defined(_STDINT_H) \ && !defined(__INC_stdint_h__) #pragma message("Review type definition of STDINT define for your platform") #endif /* _STDINT_H */ /** use where fractional values are expected * * Given a floating point value f it's .16 bit point is (int)(f*(1<<16)) */ typedef uint32_t FixPoint1616_t; #endif /* ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ */
/* vl53l0x_types.h - Zephyr customization of ST vl53l0x library, * basic type definition. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ #define ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ /* Zephyr provides stdint.h and stddef.h, so this is enough to include it. * If it was not the case, we would defined here all signed and unsigned * basic types... */ #include <stdint.h> #include <stddef.h> #ifndef NULL #error "Error NULL definition should be done. Please add required include " #endif /** use where fractional values are expected * * Given a floating point value f it's .16 bit point is (int)(f*(1<<16)) */ typedef uint32_t FixPoint1616_t; #endif /* ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ */
Add filter stub in header
/// \file api.h /// Defines the API for Query Engine. /// \author A0112054Y #pragma once #ifndef YOU_QUERYENGINE_API_H_ #define YOU_QUERYENGINE_API_H_ #include <memory> #include <boost/variant.hpp> #include "task_model.h" namespace You { namespace QueryEngine { /// A synthesized type for holding query responses typedef boost::variant < std::vector<Task>, Task, Task::ID, Task::Time, Task::Dependencies, Task::Description > Response; /// Base class for all queries. class Query { friend Response executeQuery(std::unique_ptr<Query> query); private: /// Execute the query. virtual Response execute() = 0; }; /// \name Query Constructors /// @{ /// Construct a query for adding a task /// \note Please use Task::DEFAULT_xxx to replace incomplete fields. std::unique_ptr<Query> AddTask(Task::Description description, Task::Time deadline, Task::Priority priority, Task::Dependencies dependencies); /// @} /// Execute a query and return a response /// \return The result of the query as a response object. Response executeQuery(std::unique_ptr<Query> query); } // namespace QueryEngine } // namespace You #endif // YOU_QUERYENGINE_API_H_
/// \file api.h /// Defines the API for Query Engine. /// \author A0112054Y #pragma once #ifndef YOU_QUERYENGINE_API_H_ #define YOU_QUERYENGINE_API_H_ #include <memory> #include <boost/variant.hpp> #include "task_model.h" namespace You { namespace QueryEngine { /// A synthesized type for holding query responses typedef boost::variant < std::vector<Task>, Task, Task::ID, Task::Time, Task::Dependencies, Task::Description > Response; /// Base class for all queries. class Query { friend Response executeQuery(std::unique_ptr<Query> query); private: /// Execute the query. virtual Response execute() = 0; }; /// \name Query Constructors /// @{ /// Construct a query for adding a task /// \note Please use Task::DEFAULT_xxx to replace incomplete fields. std::unique_ptr<Query> AddTask(Task::Description description, Task::Time deadline, Task::Priority priority, Task::Dependencies dependencies); std::unique_ptr<Query> FilterTask(const std::function<bool(Task)>& filter); /// @} /// Execute a query and return a response /// \return The result of the query as a response object. Response executeQuery(std::unique_ptr<Query> query); } // namespace QueryEngine } // namespace You #endif // YOU_QUERYENGINE_API_H_
Remove vi schmutz at EOF
#ifndef __EVENT_SERVICE_H__ #define __EVENT_SERVICE_H__ #include "basic_types.h" int32_t events_winopen(char *title); int32_t events_get_valuator(int32_t device); void events_qdevice(int32_t device); int32_t events_qread_start(int blocking); int32_t events_qread_continue(int16_t *value); void events_tie(int32_t button, int32_t val1, int32_t val2); #endif /* __EVENT_SERVICE_H__ */:w
#ifndef __EVENT_SERVICE_H__ #define __EVENT_SERVICE_H__ #include "basic_types.h" int32_t events_winopen(char *title); int32_t events_get_valuator(int32_t device); void events_qdevice(int32_t device); int32_t events_qread_start(int blocking); int32_t events_qread_continue(int16_t *value); void events_tie(int32_t button, int32_t val1, int32_t val2); #endif /* __EVENT_SERVICE_H__ */
Fix also applied to corresponding C file
#include <pony/pony.h> #include "encore.h" encore_actor_t *encore_create(encore_create_t *type) { return pony_create(type); } /// Allocate s bytes of memory, zeroed out void *encore_alloc(size_t *s) { void *mem = pony_alloc(s); memset(mem, 0, s); return mem; } /// The starting point of all Encore programs int encore_start(int argc, char** argv, encore_actor_t *type) { argc = pony_init(argc, argv); pony_actor_t* actor = encore_create(type); pony_sendargs(actor, _ENC__MSG_MAIN, argc, argv); return pony_start(PONY_DONT_WAIT); }
#include <pony/pony.h> #include "encore.h" encore_actor_t *encore_create(encore_actor_t *type) { return pony_create(type); } /// Allocate s bytes of memory, zeroed out void *encore_alloc(size_t *s) { void *mem = pony_alloc(s); memset(mem, 0, s); return mem; } /// The starting point of all Encore programs int encore_start(int argc, char** argv, encore_actor_t *type) { argc = pony_init(argc, argv); pony_actor_t* actor = encore_create(type); pony_sendargs(actor, _ENC__MSG_MAIN, argc, argv); return pony_start(PONY_DONT_WAIT); }
Add invariant precision worsening test for globals
// modified from 27/09 #include <assert.h> #include <pthread.h> int a = 1; int b = 1; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; void* t_fun(void *arg) { return NULL; } int main() { int *x; int rnd; if (rnd) x = &a; else x = &b; pthread_t id; pthread_create(&id, NULL, t_fun, NULL); // go multithreaded pthread_mutex_lock(&A); // continue with protected (privatized) values assert(*x == 1); b = 2; assert(a == 1); if (*x != 0) { // TODO: invariant makes less precise! assert(a == 1); // TODO } return 0; }
Tweak RSSI tracking speed/count for better graphs
#ifndef RECEIVER_H #define RECEIVER_H #include <stdint.h> #include "settings.h" #define RECEIVER_A 0 #ifdef USE_DIVERSITY #define RECEIVER_B 1 #define RECEIVER_AUTO 2 #define DIVERSITY_AUTO 0 #define DIVERSITY_FORCE_A 1 #define DIVERSITY_FORCE_B 2 #endif #define RECEIVER_LAST_DELAY 100 #define RECEIVER_LAST_DATA_SIZE 16 namespace Receiver { extern uint8_t activeReceiver; extern uint8_t activeChannel; extern uint8_t rssiA; extern uint16_t rssiARaw; extern uint8_t rssiALast[RECEIVER_LAST_DATA_SIZE]; #ifdef USE_DIVERSITY extern uint8_t rssiB; extern uint16_t rssiBRaw; extern uint8_t rssiBLast[RECEIVER_LAST_DATA_SIZE]; #endif void setChannel(uint8_t channel); void waitForStableRssi(); uint16_t updateRssi(); void setActiveReceiver(uint8_t receiver = RECEIVER_A); #ifdef USE_DIVERSITY void setDiversityMode(uint8_t mode); void switchDiversity(); #endif void setup(); void update(); } #endif
#ifndef RECEIVER_H #define RECEIVER_H #include <stdint.h> #include "settings.h" #define RECEIVER_A 0 #ifdef USE_DIVERSITY #define RECEIVER_B 1 #define RECEIVER_AUTO 2 #define DIVERSITY_AUTO 0 #define DIVERSITY_FORCE_A 1 #define DIVERSITY_FORCE_B 2 #endif #define RECEIVER_LAST_DELAY 50 #define RECEIVER_LAST_DATA_SIZE 24 namespace Receiver { extern uint8_t activeReceiver; extern uint8_t activeChannel; extern uint8_t rssiA; extern uint16_t rssiARaw; extern uint8_t rssiALast[RECEIVER_LAST_DATA_SIZE]; #ifdef USE_DIVERSITY extern uint8_t rssiB; extern uint16_t rssiBRaw; extern uint8_t rssiBLast[RECEIVER_LAST_DATA_SIZE]; #endif void setChannel(uint8_t channel); void waitForStableRssi(); uint16_t updateRssi(); void setActiveReceiver(uint8_t receiver = RECEIVER_A); #ifdef USE_DIVERSITY void setDiversityMode(uint8_t mode); void switchDiversity(); #endif void setup(); void update(); } #endif
Add function for serialize std::unique_ptr
#include <boost/serialization/version.hpp> #include <memory> namespace boost { namespace serialization { template<class Archive, class T> inline void save(Archive& ar, const std::unique_ptr<T>& t, const unsigned int){ // only the raw pointer has to be saved const T* const tx = t.get(); ar << tx; } template<class Archive, class T> inline void load(Archive& ar, std::unique_ptr<T>& t, const unsigned int){ T* pTarget; ar >> pTarget; #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) t.release(); t = std::unique_ptr< T >(pTarget); #else t.reset(pTarget); #endif } template<class Archive, class T> inline void serialize(Archive& ar, std::unique_ptr<T>& t, const unsigned int file_version){ boost::serialization::split_free(ar, t, file_version); } } // namespace serialization } // namespace boost
Adjust asm-c-connect testcase for Windows
#include <stdio.h> #if defined _WIN32 && !defined __TINYC__ # define U "_" #else # define U #endif const char str[] = "x1\n"; #ifdef __x86_64__ asm(U"x1: push %rbp; mov $"U"str, %rdi; call "U"printf; pop %rbp; ret"); #elif defined (__i386__) asm(U"x1: push $"U"str; call "U"printf; pop %eax; ret"); #endif int main(int argc, char *argv[]) { asm("call "U"x1"); asm("call "U"x2"); asm("call "U"x3"); return 0; } static int x2(void) { printf("x2\n"); return 2; } extern int x3(void);
#include <stdio.h> #if defined _WIN32 && !defined __TINYC__ # define _ "_" #else # define _ #endif static int x1_c(void) { printf("x1\n"); return 1; } asm(".text;"_"x1: call "_"x1_c; ret"); int main(int argc, char *argv[]) { asm("call "_"x1"); asm("call "_"x2"); asm("call "_"x3"); return 0; } static int x2(void) { printf("x2\n"); return 2; } extern int x3(void);
Update to add newline EOF
#pragma once #include "AuxKernel.h" #include "RadialAverage.h" /** * Auxkernel to output the averaged material value from RadialAverage */ class RadialAverageAux : public AuxKernel { public: static InputParameters validParams(); RadialAverageAux(const InputParameters & parameters); protected: virtual Real computeValue() override; const RadialAverage::Result & _average; RadialAverage::Result::const_iterator _elem_avg; };
#pragma once #include "AuxKernel.h" #include "RadialAverage.h" /** * Auxkernel to output the averaged material value from RadialAverage */ class RadialAverageAux : public AuxKernel { public: static InputParameters validParams(); RadialAverageAux(const InputParameters & parameters); protected: virtual Real computeValue() override; const RadialAverage::Result & _average; RadialAverage::Result::const_iterator _elem_avg; };
Add simple regression test for congruence domain
//PARAM: --enable ana.int.congruence --disable ana.int.def_exc --disable ana.int.enums int main() { int a = 1; int b = 2; int c = 3; int d = 4; int e = 0; while (d < 9) { b = 2 * a; d = d + 4; e = e - 4 * a; a = b - a; c = e + d; } a = d / 2; b = d % 2; assert (c == 4); // UNKNOWN! assert (d == 12); // UNKNOWN assert (a == 6); // UNKNOWN assert (b == 0); return 0; }
Revert "Add support for the Python Stdout Log"
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. #pragma once #include "ModuleManager.h" DECLARE_LOG_CATEGORY_EXTERN(LogPython, Log, All); class UNREALENGINEPYTHON_API FUnrealEnginePythonModule : public IModuleInterface { public: bool PythonGILAcquire(); void PythonGILRelease(); virtual void StartupModule() override; virtual void ShutdownModule() override; void RunString(char *); void RunFile(char *); void RunFileSandboxed(char *); private: void *ue_python_gil; // used by console void *main_dict; void *local_dict; void *main_module; }; struct FScopePythonGIL { FScopePythonGIL() { #if defined(UEPY_THREADING) UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython"); safeForRelease = UnrealEnginePythonModule.PythonGILAcquire(); #endif } ~FScopePythonGIL() { #if defined(UEPY_THREADING) if (safeForRelease) { UnrealEnginePythonModule.PythonGILRelease(); } #endif } FUnrealEnginePythonModule UnrealEnginePythonModule; bool safeForRelease; };
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. #pragma once #include "ModuleManager.h" DECLARE_LOG_CATEGORY_EXTERN(LogPython, Log, All); class UNREALENGINEPYTHON_API FUnrealEnginePythonModule : public IModuleInterface { public: bool PythonGILAcquire(); void PythonGILRelease(); virtual void StartupModule() override; virtual void ShutdownModule() override; void RunString(char *); void RunFile(char *); void RunFileSandboxed(char *); private: void *ue_python_gil; // used by console void *main_dict; void *local_dict; }; struct FScopePythonGIL { FScopePythonGIL() { #if defined(UEPY_THREADING) UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython"); safeForRelease = UnrealEnginePythonModule.PythonGILAcquire(); #endif } ~FScopePythonGIL() { #if defined(UEPY_THREADING) if (safeForRelease) { UnrealEnginePythonModule.PythonGILRelease(); } #endif } FUnrealEnginePythonModule UnrealEnginePythonModule; bool safeForRelease; };
Add ARRAYSIZE macro for Google test environment
// (C) Copyright 2017, 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. // Portability include to match the Google test environment. #ifndef TESSERACT_UNITTEST_INCLUDE_GUNIT_H_ #define TESSERACT_UNITTEST_INCLUDE_GUNIT_H_ #include "gtest/gtest.h" #include "errcode.h" // for ASSERT_HOST #include "fileio.h" // for tesseract::File const char* FLAGS_test_tmpdir = "."; class file: public tesseract::File { }; #define CHECK(test) ASSERT_HOST(test) #endif // TESSERACT_UNITTEST_INCLUDE_GUNIT_H_
// (C) Copyright 2017, 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. // Portability include to match the Google test environment. #ifndef TESSERACT_UNITTEST_INCLUDE_GUNIT_H_ #define TESSERACT_UNITTEST_INCLUDE_GUNIT_H_ #include "gtest/gtest.h" #include "errcode.h" // for ASSERT_HOST #include "fileio.h" // for tesseract::File const char* FLAGS_test_tmpdir = "."; class file: public tesseract::File { }; #define ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define CHECK(test) ASSERT_HOST(test) #endif // TESSERACT_UNITTEST_INCLUDE_GUNIT_H_
Fix some Include What You Use warnings; other minor fixes (NFC).
//===-- PPCTargetStreamer.h - PPC Target Streamer --s-----------*- C++ -*--===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETSTREAMER_H #define LLVM_LIB_TARGET_POWERPC_PPCTARGETSTREAMER_H #include "llvm/MC/MCStreamer.h" namespace llvm { class PPCTargetStreamer : public MCTargetStreamer { public: PPCTargetStreamer(MCStreamer &S); ~PPCTargetStreamer() override; virtual void emitTCEntry(const MCSymbol &S) = 0; virtual void emitMachine(StringRef CPU) = 0; virtual void emitAbiVersion(int AbiVersion) = 0; virtual void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset) = 0; }; } #endif
//===- PPCTargetStreamer.h - PPC Target Streamer ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETSTREAMER_H #define LLVM_LIB_TARGET_POWERPC_PPCTARGETSTREAMER_H #include "llvm/ADT/StringRef.h" #include "llvm/MC/MCStreamer.h" namespace llvm { class MCExpr; class MCSymbol; class MCSymbolELF; class PPCTargetStreamer : public MCTargetStreamer { public: PPCTargetStreamer(MCStreamer &S); ~PPCTargetStreamer() override; virtual void emitTCEntry(const MCSymbol &S) = 0; virtual void emitMachine(StringRef CPU) = 0; virtual void emitAbiVersion(int AbiVersion) = 0; virtual void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset) = 0; }; } // end namespace llvm #endif // LLVM_LIB_TARGET_POWERPC_PPCTARGETSTREAMER_H
Fix including framework headers' path
#import <UIKit/UIKit.h> //! Project version number for YOChartImageKit. FOUNDATION_EXPORT double YOChartImageKitVersionNumber; //! Project version string for YOChartImageKit. FOUNDATION_EXPORT const unsigned char YOChartImageKitVersionString[]; #import <YOChartImageKit/YODonutChartImage.h> #import <YOChartImageKit/YOBarChartImage.h> #import <YOChartImageKit/YOLineChartImage.h>
#import <UIKit/UIKit.h> //! Project version number for YOChartImageKit. FOUNDATION_EXPORT double YOChartImageKitVersionNumber; //! Project version string for YOChartImageKit. FOUNDATION_EXPORT const unsigned char YOChartImageKitVersionString[]; #import "YODonutChartImage.h" #import "YOBarChartImage.h" #import "YOLineChartImage.h"
Add exmpale of confusion between locals of different procedures :/
// SKIP PARAM: --set solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','apron','escape']" --set ana.base.privatization none --set ana.apron.privatization dummy extern int __VERIFIER_nondet_int(); void change(int *p) { int a; (*p)++; a++; assert(a == 7); //UNKNOWN! } int g; int main() { int c = __VERIFIER_nondet_int(); int a = 5; int *p = &a; change(p); assert(a == 5); //FAIL assert(a - 6 == 0); // Apron currently finds \bot here (!) return 0; }
Add 1-10 external variable example
// // Created by matti on 16.9.2015. // #include <stdio.h> #define MAXLINE 1000 int max; char line[MAXLINE]; char longest[MAXLINE]; int getline(void); void copy(void); int main() { int len; extern int max; extern char longest[]; max = 0; while((len = getline()) > 0) { if (len > max) { max = len; copy(); } if (max > 0) { printf("%s", longest); } return 0; } } int getline(void) { int c, i; extern char line[]; for(i = 0; i < MAXLINE - 1 && (c=getchar()) != EOF && c != '\n'; ++i) { line[i] = c; if (c == '\n') { line[i] = c; ++i; } line[i] = '\0'; return i; } }
// // Created by matti on 16.9.2015. // #include <stdio.h> #define MAXLINE 1000 int max; char line[MAXLINE]; char longest[MAXLINE]; int getnewline(void); void copy(void); int main() { int len; extern int max; extern char longest[]; max = 0; while((len = getnewline()) > 0) { if (len > max) { max = len; copy(); } if (max > 0) { printf("%s", longest); } return 0; } } int getnewline(void) { int c, i; extern char line[]; for(i = 0; i < MAXLINE - 1 && (c=getchar()) != EOF && c != '\n'; ++i) { line[i] = c; } if (c == '\n') { line[i] = c; ++i; } line[i] = '\0'; return i; } void copy(void) { int i; extern char line[], longest[]; i = 0; while((longest[i] = line[i]) != '\0') { ++i; } }
Move glib-object.h include inside USE_GLIB conditional
#ifndef MYPAINTBRUSHGLIB_H #define MYPAINTBRUSHGLIB_H #include <glib-object.h> #include <mypaint-config.h> #if MYPAINT_CONFIG_USE_GLIB #define MYPAINT_TYPE_BRUSH (mypaint_brush_get_type ()) #define MYPAINT_VALUE_HOLDS_BRUSH(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_TYPE_BRUSH)) GType mypaint_brush_get_type(void); #endif #endif // MYPAINTBRUSHGLIB_H
#ifndef MYPAINTBRUSHGLIB_H #define MYPAINTBRUSHGLIB_H #include <mypaint-config.h> #if MYPAINT_CONFIG_USE_GLIB #include <glib-object.h> #define MYPAINT_TYPE_BRUSH (mypaint_brush_get_type ()) #define MYPAINT_VALUE_HOLDS_BRUSH(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_TYPE_BRUSH)) GType mypaint_brush_get_type(void); #endif #endif // MYPAINTBRUSHGLIB_H
Check in header file that was missing, thus broke the build
//===-- InstLoops.h - interface to insert instrumentation --------*- C++ -*--=// // // Instrument every back edges with counters //===----------------------------------------------------------------------===// #ifndef LLVM_REOPTIMIZERINSTLOOPS_H #define LLVM_REOPTIMIZERINSTLOOPS_H class Pass; // createInstLoopsPass - Create a new pass to add counters on back edges // Pass *createInstLoopsPass(); #endif
Reduce compiled code size by storing a result of a likely-used common expression
#include "cisf.h" #include "expf.h" float _Complex cexpf(float _Complex z) { float x = z; float y = cimagf(z); if (y == 0) return CMPLXF(expf_(x), y); if (y - y) { if (x == INFINITY) return CMPLXF(x, y - y); if (x == -INFINITY) return 0; } return expf_(x) * cisf_(y); }
#include "cisf.h" #include "expf.h" float _Complex cexpf(float _Complex z) { float x = z; float y = cimagf(z); double r = expf_(x); if (y == 0) return CMPLXF(r, y); if (y - y) { if (x == INFINITY) return CMPLXF(x, y - y); if (x == -INFINITY) return 0; } return r * cisf_(y); }
Create a class for drawing progress bars on a console window
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef CONSOLE_PROGRESS_BAR_H #define CONSOLE_PROGRESS_BAR_H #include "common/typedefs.h" #include "rlutil.h" #include <cassert> namespace Common { class ConsoleProgressBar { public: ConsoleProgressBar(); private: uint m_numCols; uint m_verticalOffset; public: void DrawProgress(uint progress); void SetVerticalOffset(uint offset); }; ConsoleProgressBar::ConsoleProgressBar() : m_numCols(rlutil::tcols()), m_verticalOffset(1) { } void ConsoleProgressBar::DrawProgress(uint progress) { rlutil::locate(1, 3); std::cout << progress << " %" << std::endl << std::endl; rlutil::locate(7, m_verticalOffset); uint numberOfTicks = progress * (m_numCols - 6) / 100; for (uint i = 0; i < numberOfTicks; ++i) { std::cout << (char)(219); } for (uint i = numberOfTicks; i < m_numCols - 6; ++i) { std::cout << ' '; } } void ConsoleProgressBar::SetVerticalOffset(uint offset) { assert(offset <= rlutil::trows()); m_verticalOffset = offset; } } #endif
Make it easy to iterate a vector
#ifndef LB_VECTOR_INCLUDED #include "lb_scalar.h" // Assume Vector to be n rows by 1 column typedef struct { Scalar* data; unsigned int length; } Vector; Vector lb_create_vector(Scalar* data, unsigned int length); Vector lb_allocate_vector(unsigned int length); void lbdp(Vector a, Vector b, Scalar* result); void lbstv(Scalar s, Vector v, Vector result); #define LB_VECTOR_INCLUDED #endif
#ifndef LB_VECTOR_INCLUDED #include "lb_scalar.h" // Assume Vector to be n rows by 1 column typedef struct { Scalar* data; unsigned int length; } Vector; Vector lb_create_vector(Scalar* data, unsigned int length); Vector lb_allocate_vector(unsigned int length); void lbdp(Vector a, Vector b, Scalar* result); void lbstv(Scalar s, Vector v, Vector result); #define lbv_iterate(vec, iter, expr) do{\ unsigned int iter;\ for(iter=0; iter < vec.length; iter++) {\ expr;\ }\ } while(0); #define LB_VECTOR_INCLUDED #endif
Update prefix for CW Pro1
#include <MacHeaders.h> #include <ansi_prefix.mac.h> #pragma once off #define HAVE_CONFIG_H #define PORT 1 #define MACOS 1 #define CONFIGLESS 1 #include "prefix.h"
#include <MacHeaders.h> //#include <ansi_prefix.mac.h> #pragma once off #define HAVE_CONFIG_H #define PORT 1 #define MACOS 1 #define CONFIGLESS 1 #include "prefix.h"
Restructure for code reuse and hiding implementation.
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <cstdint> namespace search::queryeval { struct IDiversifier { virtual ~IDiversifier() {} /** * Will tell if this document should be kept, and update state for further filtering. */ virtual bool accepted(uint32_t docId) = 0; }; }
Fix compilation of constructor_global module
/* * cxx_constructors_global.c * * Created on: 30 janv. 2013 * Author: fsulima */ #include <embox/unit.h> EMBOX_UNIT_INIT(cxx_init); EMBOX_UNIT_FINI(cxx_fini); #include "cxx_invoke_constructors.h" #include "cxx_invoke_destructors.h" #include "cxx_app_startup_terminatioin.h" static int cxx_init(void) { cxx_invoke_constructors(); return 0; } static int cxx_fini(void) { cxx_invoke_destructors(); return 0; } void cxx_app_startup(void) { } void cxx_app_termination(void) { }
/* * cxx_constructors_global.c * * Created on: 30 janv. 2013 * Author: fsulima */ #include <embox/unit.h> #include "cxx_invoke_constructors.h" #include "cxx_invoke_destructors.h" #include "cxx_app_startup_termination.h" EMBOX_UNIT(cxx_init, cxx_fini); static int cxx_init(void) { cxx_invoke_constructors(); return 0; } static int cxx_fini(void) { cxx_invoke_destructors(); return 0; } void cxx_app_startup(void) { } void cxx_app_termination(void) { }
Include latest class additions in umbrella include.
// // Mapping.h // Menu // // Created by Matt on 21/07/15. // Copyright (c) 2015 Blue Rocket. All rights reserved. // #import <BRMenu/UI/BRMenuPlusMinusButton.h> #import <BRMenu/UI/BRMenuStepper.h> #import <BRMenu/UI/BRMenuUIStyle.h>
// // Mapping.h // Menu // // Created by Matt on 21/07/15. // Copyright (c) 2015 Blue Rocket. All rights reserved. // #import <BRMenu/UI/BRMenuBackBarButtonItemView.h> #import <BRMenu/UI/BRMenuBarButtonItemView.h> #import <BRMenu/UI/BRMenuPlusMinusButton.h> #import <BRMenu/UI/BRMenuStepper.h> #import <BRMenu/UI/BRMenuUIStyle.h>
Fix compiler warning in Leap
#ifndef _LEAP_H #define _LEAP_H #include <stdbool.h> bool leap_year(int year); #endif
#ifndef _LEAP_H #define _LEAP_H #include <stdbool.h> bool is_leap_year(int year); #endif
Test is broken; XFAIL it until Argyrios gets a chance to look at it.
// RUN: %clang_cc1 %s -Wunused-macros -Dfoo -Dfoo -verify #include "warn-macro-unused.h" #define unused // expected-warning {{macro is not used}} #define unused unused // rdar://9745065 #undef unused_from_header // no warning
// RUN: %clang_cc1 %s -Wunused-macros -Dfoo -Dfoo -verify // XFAIL: * #include "warn-macro-unused.h" #define unused // expected-warning {{macro is not used}} #define unused unused // rdar://9745065 #undef unused_from_header // no warning
Fix disabled interaction on device
// // HATransparentView.h // HATransparentView // // Created by Heberti Almeida on 13/09/13. // Copyright (c) 2013 Heberti Almeida. All rights reserved. // #import <UIKit/UIKit.h> @interface HATransparentView : UIView @property (strong, nonatomic) UIColor *color; @property (nonatomic) CGFloat *alpha; - (void)open; - (void)close; @end
// // HATransparentView.h // HATransparentView // // Created by Heberti Almeida on 13/09/13. // Copyright (c) 2013 Heberti Almeida. All rights reserved. // #import <UIKit/UIKit.h> @interface HATransparentView : UIView - (void)open; - (void)close; @end
Fix the import in the bridge header file to account for changes in RN 0.48
// // InstabugReactBridge.h // instabugDemo // // Created by Yousef Hamza on 9/29/16. // Copyright © 2016 Facebook. All rights reserved. // #import <Foundation/Foundation.h> #import "RCTBridgeModule.h" #import "RCTEventEmitter.h" @interface InstabugReactBridge : RCTEventEmitter <RCTBridgeModule> @end
// // InstabugReactBridge.h // instabugDemo // // Created by Yousef Hamza on 9/29/16. // Copyright © 2016 Facebook. All rights reserved. // #import <Foundation/Foundation.h> #import <React/RCTBridgeModule.h> #import "RCTEventEmitter.h" @interface InstabugReactBridge : RCTEventEmitter <RCTBridgeModule> @end
Fix the previous commit: the 'initialize()' function wasn't declared in the 'Athena::Physics' namespace
/** @file Prerequisites.h @author Philip Abbet Declaration of the types of the Athena-Physics module */ #ifndef _ATHENA_PHYSICS_PREREQUISITES_H_ #define _ATHENA_PHYSICS_PREREQUISITES_H_ #include <Athena-Core/Prerequisites.h> #include <Athena-Physics/Config.h> #include <Bullet/btConfig.h> #include <btBulletDynamicsCommon.h> //---------------------------------------------------------------------------------------- /// @brief Main namespace. All the components of the Athena engine belongs to this /// namespace //---------------------------------------------------------------------------------------- namespace Athena { //------------------------------------------------------------------------------------ /// @brief Contains all the physics-related classes //------------------------------------------------------------------------------------ namespace Physics { class Body; class CollisionShape; class PhysicalComponent; class World; class BoxShape; class CapsuleShape; class ConeShape; class CylinderShape; class SphereShape; class StaticTriMeshShape; } //------------------------------------------------------------------------------------ /// @brief Initialize the Physics module //------------------------------------------------------------------------------------ extern void initialize(); } #endif
/** @file Prerequisites.h @author Philip Abbet Declaration of the types of the Athena-Physics module */ #ifndef _ATHENA_PHYSICS_PREREQUISITES_H_ #define _ATHENA_PHYSICS_PREREQUISITES_H_ #include <Athena-Core/Prerequisites.h> #include <Athena-Physics/Config.h> #include <Bullet/btConfig.h> #include <btBulletDynamicsCommon.h> //---------------------------------------------------------------------------------------- /// @brief Main namespace. All the components of the Athena engine belongs to this /// namespace //---------------------------------------------------------------------------------------- namespace Athena { //------------------------------------------------------------------------------------ /// @brief Contains all the physics-related classes //------------------------------------------------------------------------------------ namespace Physics { class Body; class CollisionShape; class PhysicalComponent; class World; class BoxShape; class CapsuleShape; class ConeShape; class CylinderShape; class SphereShape; class StaticTriMeshShape; //------------------------------------------------------------------------------------ /// @brief Initialize the Physics module //------------------------------------------------------------------------------------ extern void initialize(); } } #endif
Fix path to vulkan header.
/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrVkVulkan_DEFINED #define GrVkVulkan_DEFINED #include "SkTypes.h" #ifdef VULKAN_CORE_H_ #error "Skia's private vulkan header must be included before any other vulkan header." #endif #include "../../third_party/vulkan/vulkan/vulkan_core.h" #ifdef SK_BUILD_FOR_ANDROID #ifdef VULKAN_ANDROID_H_ #error "Skia's private vulkan android header must be included before any other vulkan header." #endif // This is needed to get android extensions for external memory #include "../../third_party/vulkan/vulkan/vulkan_android.h" #endif #endif
/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrVkVulkan_DEFINED #define GrVkVulkan_DEFINED #include "SkTypes.h" #ifdef VULKAN_CORE_H_ #error "Skia's private vulkan header must be included before any other vulkan header." #endif #include "../../../include/third_party/vulkan/vulkan/vulkan_core.h" #ifdef SK_BUILD_FOR_ANDROID #ifdef VULKAN_ANDROID_H_ #error "Skia's private vulkan android header must be included before any other vulkan header." #endif // This is needed to get android extensions for external memory #include "../../../include/third_party/vulkan/vulkan/vulkan_android.h" #endif #endif
Fix warning in PBKDF1 copy constructor
/************************************************* * PBKDF1 Header File * * (C) 1999-2007 Jack Lloyd * *************************************************/ #ifndef BOTAN_PBKDF1_H__ #define BOTAN_PBKDF1_H__ #include <botan/s2k.h> #include <botan/base.h> namespace Botan { /************************************************* * PKCS #5 PBKDF1 * *************************************************/ class BOTAN_DLL PKCS5_PBKDF1 : public S2K { public: std::string name() const; S2K* clone() const; PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {} PKCS5_PBKDF1(const PKCS5_PBKDF1& other) : hash(other.hash->clone()) {} ~PKCS5_PBKDF1() { delete hash; } private: OctetString derive(u32bit, const std::string&, const byte[], u32bit, u32bit) const; HashFunction* hash; }; } #endif
/************************************************* * PBKDF1 Header File * * (C) 1999-2007 Jack Lloyd * *************************************************/ #ifndef BOTAN_PBKDF1_H__ #define BOTAN_PBKDF1_H__ #include <botan/s2k.h> #include <botan/base.h> namespace Botan { /************************************************* * PKCS #5 PBKDF1 * *************************************************/ class BOTAN_DLL PKCS5_PBKDF1 : public S2K { public: std::string name() const; S2K* clone() const; PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {} PKCS5_PBKDF1(const PKCS5_PBKDF1& other) : S2K(), hash(other.hash->clone()) {} ~PKCS5_PBKDF1() { delete hash; } private: OctetString derive(u32bit, const std::string&, const byte[], u32bit, u32bit) const; HashFunction* hash; }; } #endif
Convert default font name into an NSString
#ifndef AppIconOverlay_config_h #define AppIconOverlay_config_h #define DEBUG 1 #define DEFAULT_MIN_FONT_SIZE 6.0 #define DEFAULT_MAX_FONT_SIZE 18.0 #define DEFAULT_FONT_TO_USE "Arial-BoldMT" #endif
#ifndef AppIconOverlay_config_h #define AppIconOverlay_config_h #define DEBUG 1 #define DEFAULT_MIN_FONT_SIZE 6.0 #define DEFAULT_MAX_FONT_SIZE 18.0 #define DEFAULT_FONT_TO_USE @"Arial-BoldMT" #endif
Remove unused external function definitions.
/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "vpx_ports/config.h" #include "vp8/decoder/onyxd_int.h" #include "vp8/common/opencl/vp8_opencl.h" #include "vp8_decode_cl.h" extern void vp8_dequantize_b_cl(BLOCKD*); extern void vp8_dequant_dc_idct_add_cl(short*, short*, unsigned char*, unsigned char*, int, int, int Dc); void vp8_arch_opencl_decode_init(VP8D_COMP *pbi) { if (cl_initialized == CL_SUCCESS){ cl_decode_init(); } }
/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "vpx_ports/config.h" #include "vp8/decoder/onyxd_int.h" #include "vp8/common/opencl/vp8_opencl.h" #include "vp8_decode_cl.h" void vp8_arch_opencl_decode_init(VP8D_COMP *pbi) { if (cl_initialized == CL_SUCCESS){ cl_decode_init(); } }
Fix no-return for non-GCC and non-VS.
/* Title: No return header. Author: David C.J. Matthews Copyright (c) 2006, 2015 David C.J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _NORETURN_H #define _NORETURN_H /* The exception functions don't return but instead raise exceptions. This macro tells the compiler about this and prevents spurious errors. */ #if (defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) #define NORETURNFN(x) __declspec(noreturn) x #elif defined(__GNUC__) || defined(__attribute__) #define NORETURNFN(x) x __attribute__((noreturn)) #else #define NORETURNFN(x) #endif #endif
/* Title: No return header. Author: David C.J. Matthews Copyright (c) 2006, 2015 David C.J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _NORETURN_H #define _NORETURN_H /* The exception functions don't return but instead raise exceptions. This macro tells the compiler about this and prevents spurious errors. */ #if (defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) #define NORETURNFN(x) __declspec(noreturn) x #elif defined(__GNUC__) || defined(__attribute__) #define NORETURNFN(x) x __attribute__((noreturn)) #else #define NORETURNFN(x) x #endif #endif
Fix include statement of FLTK header such that it compiles with FLTK 1.3 without requiring backwards compatible link creation.
#ifndef Fl_Value_Slider2_H #define Fl_Value_Slider2_H #include "Fl/Fl_Slider.H" class Fl_Value_Slider2 : public Fl_Slider { uchar textfont_, textsize_; unsigned textcolor_; public: void draw(); int handle(int); Fl_Value_Slider2(int x,int y,int w,int h, const char *l = 0); Fl_Font textfont() const {return (Fl_Font)textfont_;} void textfont(uchar s) {textfont_ = s;} uchar textsize() const {return textsize_;} void textsize(uchar s) {textsize_ = s;} Fl_Color textcolor() const {return (Fl_Color)textcolor_;} void textcolor(unsigned s) {textcolor_ = s;} }; #endif
#ifndef Fl_Value_Slider2_H #define Fl_Value_Slider2_H #include <FL/Fl_Slider.H> class Fl_Value_Slider2 : public Fl_Slider { uchar textfont_, textsize_; unsigned textcolor_; public: void draw(); int handle(int); Fl_Value_Slider2(int x,int y,int w,int h, const char *l = 0); Fl_Font textfont() const {return (Fl_Font)textfont_;} void textfont(uchar s) {textfont_ = s;} uchar textsize() const {return textsize_;} void textsize(uchar s) {textsize_ = s;} Fl_Color textcolor() const {return (Fl_Color)textcolor_;} void textcolor(unsigned s) {textcolor_ = s;} }; #endif
Add another / to a couple comments in Problem 14 to make intended Doxygen comments visible as such.
//===-- problems/Problem14.h ------------------------------------*- C++ -*-===// // // ProjectEuler.net solutions by Will Mitchell // // This file is distributed under the MIT License. See LICENSE for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Problem 14: Longest Collatz sequence /// //===----------------------------------------------------------------------===// #ifndef PROBLEMS_PROBLEM14_H #define PROBLEMS_PROBLEM14_H #include <string> #include <vector> #include "../Problem.h" namespace problems { class Problem14 : public Problem { public: Problem14() : start(0), length(0), solved(false) {} ~Problem14() = default; std::string answer(); std::string description() const; void solve(); // Simple brute force solution unsigned long long bruteForce(const unsigned long long limit) const; // Simple brute force solution with memoization unsigned long long faster(const unsigned long long limit, const std::vector<unsigned long long>::size_type cacheSize) const; private: /// Cached answer unsigned long long start; /// Cached answer mutable unsigned long long length; /// If cached answer is valid bool solved; }; } #endif
//===-- problems/Problem14.h ------------------------------------*- C++ -*-===// // // ProjectEuler.net solutions by Will Mitchell // // This file is distributed under the MIT License. See LICENSE for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Problem 14: Longest Collatz sequence /// //===----------------------------------------------------------------------===// #ifndef PROBLEMS_PROBLEM14_H #define PROBLEMS_PROBLEM14_H #include <string> #include <vector> #include "../Problem.h" namespace problems { class Problem14 : public Problem { public: Problem14() : start(0), length(0), solved(false) {} ~Problem14() = default; std::string answer(); std::string description() const; void solve(); /// Simple brute force solution unsigned long long bruteForce(const unsigned long long limit) const; /// Simple brute force solution with memoization unsigned long long faster(const unsigned long long limit, const std::vector<unsigned long long>::size_type cacheSize) const; private: /// Cached answer unsigned long long start; /// Cached answer mutable unsigned long long length; /// If cached answer is valid bool solved; }; } #endif
Add more assert statements to test case
//PARAM: --enable ana.int.enums --disable ana.int.def_exc int main(){ int top = rand(); int x,y; if(top){ x = 1; } else{ x = 0; } assert(x<2); return 0; }
//PARAM: --enable ana.int.enums --disable ana.int.def_exc int main(){ int top = rand(); int x,y; if(top){ x = 1; } else{ x = 0; } assert(x < 2); assert(x < 1); // UNKNOWN! assert(x < 0); // FAIL assert(x <= 2); assert(x <= 1); assert(x <= 0); // UNKNOWN! assert(x <= -1); //FAIL assert(x > -1); assert(x > 0); //UNKNOWN! assert(x > 1); //FAIL assert(x >= -1); assert(x >= 0); assert(x >= 1); //UNKNOWN! assert(x >= 2); //FAIL return 0; }
Replace `if (p) free(p)' with `mh_xfree(p)'.
/* * folder_free.c -- free a folder/message structure * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ #include <h/mh.h> void folder_free (struct msgs *mp) { size_t i; bvector_t *v; if (!mp) return; if (mp->foldpath) free (mp->foldpath); /* free the sequence names */ for (i = 0; i < svector_size (mp->msgattrs); i++) free (svector_at (mp->msgattrs, i)); svector_free (mp->msgattrs); for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) { bvector_free (*v); } free (mp->msgstats); /* Close/free the sequence file if it is open */ if (mp->seqhandle) lkfclosedata (mp->seqhandle, mp->seqname); if (mp->seqname) free (mp->seqname); bvector_free (mp->attrstats); free (mp); /* free main folder structure */ }
/* * folder_free.c -- free a folder/message structure * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ #include <h/mh.h> #include <h/utils.h> void folder_free (struct msgs *mp) { size_t i; bvector_t *v; if (!mp) return; mh_xfree(mp->foldpath); /* free the sequence names */ for (i = 0; i < svector_size (mp->msgattrs); i++) free (svector_at (mp->msgattrs, i)); svector_free (mp->msgattrs); for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) { bvector_free (*v); } free (mp->msgstats); /* Close/free the sequence file if it is open */ if (mp->seqhandle) lkfclosedata (mp->seqhandle, mp->seqname); mh_xfree(mp->seqname); bvector_free (mp->attrstats); free (mp); /* free main folder structure */ }
Add the grub-specific charset functions. (dm)
/* * BRLTTY - A background process providing access to the console screen (when in * text mode) for a blind person using a refreshable braille display. * * Copyright (C) 1995-2012 by The BRLTTY Developers. * * BRLTTY comes with ABSOLUTELY NO WARRANTY. * * This is free software, placed under the terms of the * GNU General Public License, as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any * later version. Please see the file LICENSE-GPL for details. * * Web Page: http://mielke.cc/brltty/ * * This software is maintained by Dave Mielke <dave@mielke.cc>. */ #include "prologue.h" #include <locale.h> #include <wchar.h> #include "charset_internal.h" wint_t convertCharToWchar (char c) { return (unsigned char)c; } int convertWcharToChar (wchar_t wc) { return wc & 0XFF; } const char * getLocaleCharset (void) { return nl_langinfo(CODESET); } int registerCharacterSet (const char *charset) { return grub_strcasecmp(charset, "UTF-8") == 0; }
Remove rint() prototype from QNX.
#include <sys/types.h> /* for namser.h */ #include <arpa/nameser.h> /* for BYTE_ORDER */ #include <process.h> /* for execv */ #include <ioctl.h> /* for unix.h */ #include <unix.h> #include <sys/select.h> /* for select */ #define HAS_TEST_AND_SET #undef HAVE_GETRUSAGE #define strncasecmp strnicmp #ifndef NAN #ifndef __nan_bytes #define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } #endif /* __nan_bytes */ extern unsigned char __nan[8]; #define NAN (*(const double *) __nan) #endif /* NAN */ typedef u_short ushort; typedef unsigned char slock_t; extern int isnan(double dsrc); extern double rint(double x); extern char *crypt(const char *, const char *); extern long random(void); extern void srandom(unsigned int seed);
#include <sys/types.h> /* for namser.h */ #include <arpa/nameser.h> /* for BYTE_ORDER */ #include <process.h> /* for execv */ #include <ioctl.h> /* for unix.h */ #include <unix.h> #include <sys/select.h> /* for select */ #define HAS_TEST_AND_SET #undef HAVE_GETRUSAGE #define strncasecmp strnicmp #ifndef NAN #ifndef __nan_bytes #define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } #endif /* __nan_bytes */ extern unsigned char __nan[8]; #define NAN (*(const double *) __nan) #endif /* NAN */ typedef u_short ushort; typedef unsigned char slock_t; extern int isnan(double dsrc); extern char *crypt(const char *, const char *); extern long random(void); extern void srandom(unsigned int seed);
Remove unnecessary lldb_enable_attach in TestMultilineCompletion
int main(int argc, char **argv) { lldb_enable_attach(); int to_complete = 0; return to_complete; }
int main(int argc, char **argv) { int to_complete = 0; return to_complete; }
Fix a typo, that could cause a crash on mac.
// Copyright (c) 2008 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 NET_PROXY_PROXY_RESOLVER_MAC_H_ #define NET_PROXY_PROXY_RESOLVER_MAC_H_ #pragma once #include <string> #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/proxy/proxy_resolver.h" namespace net { // Implementation of ProxyResolver that uses the Mac CFProxySupport to implement // proxies. class ProxyResolverMac : public ProxyResolver { public: ProxyResolverMac() : ProxyResolver(false /*expects_pac_bytes*/) {} // ProxyResolver methods: virtual int GetProxyForURL(const GURL& url, ProxyInfo* results, CompletionCallback* callback, RequestHandle* request, const BoundNetLog& net_log); virtual void CancelRequest(RequestHandle request) { NOTREACHED(); } virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, CompletionCallback* /*callback*/) { script_data_ = script_data_; return OK; } private: scoped_refptr<ProxyResolverScriptData> script_data_; }; } // namespace net #endif // NET_PROXY_PROXY_RESOLVER_MAC_H_
// Copyright (c) 2008 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 NET_PROXY_PROXY_RESOLVER_MAC_H_ #define NET_PROXY_PROXY_RESOLVER_MAC_H_ #pragma once #include <string> #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/proxy/proxy_resolver.h" namespace net { // Implementation of ProxyResolver that uses the Mac CFProxySupport to implement // proxies. class ProxyResolverMac : public ProxyResolver { public: ProxyResolverMac() : ProxyResolver(false /*expects_pac_bytes*/) {} // ProxyResolver methods: virtual int GetProxyForURL(const GURL& url, ProxyInfo* results, CompletionCallback* callback, RequestHandle* request, const BoundNetLog& net_log); virtual void CancelRequest(RequestHandle request) { NOTREACHED(); } virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, CompletionCallback* /*callback*/) { script_data_ = script_data; return OK; } private: scoped_refptr<ProxyResolverScriptData> script_data_; }; } // namespace net #endif // NET_PROXY_PROXY_RESOLVER_MAC_H_
Make build crash early on purpose (to test test suite...)
/* ISC license. */ /* MT-unsafe */ #include <skalibs/stralloc.h> #include <skalibs/skamisc.h> #include <skalibs/djbunix.h> int sarealpath (stralloc *sa, char const *path) { return sarealpath_tmp(sa, path, &satmp) ; }
/* ISC license. */ /* MT-unsafe */ #include <skalibs/stralloc.h> #include <skalibs/skamisc.h> #include <skalibs/djbunix.h> BUG int sarealpath (stralloc *sa, char const *path) { return sarealpath_tmp(sa, path, &satmp) ; }
Add peek methods to mock queue.
#ifndef TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #define TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #include <stdint.h> #include "gmock/gmock.h" #include "lib/queue_interface.h" namespace tachyon { namespace testing { // Mock class for queues. template <class T> class MockQueue : public QueueInterface<T> { public: MOCK_METHOD1_T(Enqueue, bool(const T &item)); MOCK_METHOD1_T(EnqueueBlocking, bool(const T &item)); MOCK_METHOD1_T(DequeueNext, bool(T *item)); MOCK_METHOD1_T(DequeueNextBlocking, void(T *item)); MOCK_CONST_METHOD0_T(GetOffset, int()); MOCK_METHOD0_T(FreeQueue, void()); MOCK_CONST_METHOD0_T(GetNumConsumers, uint32_t()); }; } // namespace testing } // namespace tachyon #endif // TACHYON_TEST_UTILS_MOCK_QUEUE_H_
#ifndef TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #define TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #include <stdint.h> #include "gmock/gmock.h" #include "lib/queue_interface.h" namespace tachyon { namespace testing { // Mock class for queues. template <class T> class MockQueue : public QueueInterface<T> { public: MOCK_METHOD1_T(Enqueue, bool(const T &item)); MOCK_METHOD1_T(EnqueueBlocking, bool(const T &item)); MOCK_METHOD1_T(DequeueNext, bool(T *item)); MOCK_METHOD1_T(DequeueNextBlocking, void(T *item)); MOCK_METHOD1_T(PeekNext, bool(T *item)); MOCK_METHOD1_T(PeekNextBlocking, void(T *item)); MOCK_CONST_METHOD0_T(GetOffset, int()); MOCK_METHOD0_T(FreeQueue, void()); MOCK_CONST_METHOD0_T(GetNumConsumers, uint32_t()); }; } // namespace testing } // namespace tachyon #endif // TACHYON_TEST_UTILS_MOCK_QUEUE_H_