Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Use 'class' keyword for Target to treat file as C++
/* * target.h - input interface for Fetch module * @author Pavel Kryukov pavel.kryukov@phystech.edu * Copyright 2018 MIPT-MIPS */ #ifndef TARGET_H #define TARGET_H #include <infra/types.h> /* * Target is an input interface for Fetch module * It contains * * address where instruction should be fetched * * sequence_id of fetched instruction for instrumentation purposes * * validity bit */ struct Target { Addr address = NO_VAL32; uint64 sequence_id = NO_VAL64; bool valid = false; Target() = default; Target(Addr a, uint64 id) : address(a) , sequence_id(id) , valid(true) { } }; #endif
/* * target.h - input interface for Fetch module * @author Pavel Kryukov pavel.kryukov@phystech.edu * Copyright 2018 MIPT-MIPS */ #ifndef TARGET_H #define TARGET_H #include <infra/types.h> /* * Target is an input interface for Fetch module * It contains * * address where instruction should be fetched * * sequence_id of fetched instruction for instrumentation purposes * * validity bit */ class Target { public: Addr address = NO_VAL32; uint64 sequence_id = NO_VAL64; bool valid = false; Target() = default; Target( Addr a, uint64 id) : address( a) , sequence_id( id) , valid( true) { } }; #endif
Use an unique ID for Crosswalk Extension IPC messages
// Copyright (c) 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <string> #include "ipc/ipc_message_macros.h" #define IPC_MESSAGE_START ExtensionMsgStart IPC_MESSAGE_ROUTED2(XWalkViewHostMsg_PostMessage, // NOLINT(*) std::string /* target extension */, std::string /* contents */) IPC_MESSAGE_ROUTED2(XWalkViewMsg_PostMessage, // NOLINT(*) std::string /* source extension */, std::string /* contents */) IPC_MESSAGE_CONTROL2(XWalkViewMsg_RegisterExtension, // NOLINT(*) std::string /* extension */, std::string /* JS API code for extension */)
// Copyright (c) 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <string> #include "ipc/ipc_message_macros.h" // Note: it is safe to use numbers after LastIPCMsgStart since that limit // is not relevant for embedders. It is used only by a tool inside chrome/ // that we currently don't use. // See also https://code.google.com/p/chromium/issues/detail?id=110911. const int XWalkExtensionMsgStart = LastIPCMsgStart + 1; #define IPC_MESSAGE_START XWalkExtensionMsgStart IPC_MESSAGE_ROUTED2(XWalkViewHostMsg_PostMessage, // NOLINT(*) std::string /* target extension */, std::string /* contents */) IPC_MESSAGE_ROUTED2(XWalkViewMsg_PostMessage, // NOLINT(*) std::string /* source extension */, std::string /* contents */) IPC_MESSAGE_CONTROL2(XWalkViewMsg_RegisterExtension, // NOLINT(*) std::string /* extension */, std::string /* JS API code for extension */)
Add more comment for library instance and remove unused internal header file.
/** @file UEFI Runtime Services Table Library. Copyright (c) 2006, Intel Corporation<BR> All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include <Uefi.h> #include <Library/DebugLib.h> EFI_RUNTIME_SERVICES *gRT = NULL; /** The constructor function caches the pointer of Runtime Services Table. The constructor function caches the pointer of Runtime Services Table. It will ASSERT() if the pointer of Runtime Services Table is NULL. It will always return EFI_SUCCESS. @param ImageHandle The firmware allocated handle for the EFI image. @param SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. **/ EFI_STATUS EFIAPI UefiRuntimeServicesTableLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // Cache pointer to the EFI Runtime Services Table // gRT = SystemTable->RuntimeServices; ASSERT (gRT != NULL); return EFI_SUCCESS; }
/** @file UEFI Runtime Services Table Library. This library instance retrieve EFI_RUNTIME_SERVICES pointer from EFI system table in library's constructor. Copyright (c) 2006, Intel Corporation<BR> All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include <Uefi.h> #include <Library/DebugLib.h> EFI_RUNTIME_SERVICES *gRT = NULL; /** The constructor function caches the pointer of Runtime Services Table. The constructor function caches the pointer of Runtime Services Table. It will ASSERT() if the pointer of Runtime Services Table is NULL. It will always return EFI_SUCCESS. @param ImageHandle The firmware allocated handle for the EFI image. @param SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. **/ EFI_STATUS EFIAPI UefiRuntimeServicesTableLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // Cache pointer to the EFI Runtime Services Table // gRT = SystemTable->RuntimeServices; ASSERT (gRT != NULL); return EFI_SUCCESS; }
Fix runtime_error is not a member of std
/* * MenuRenderer.h * * Created on: Nov 18, 2016 * Author: msaun */ #ifndef MICKRENDERER_H_ #define MICKRENDERER_H_ #include <string> #include "RuntimeException.h" #include <SDL2/SDL.h> #include <GL/glew.h> #include <Rocket/Core.h> #include <Rocket/Core/Input.h> #include <Rocket/Debugger/Debugger.h> #include "rocket/glue/SystemInterfaceSDL2.h" #include "rocket/glue/RenderInterfaceSDL2.h" #include "rocket/glue/ShellFileInterface.h" #include "rocket/MickRocketElementUtil.h" #include "GameSettings.h" #include "rocket/events/EventInstancer.h" #include "rocket/events/EventManager.h" #include "rocket/events/EventHandlerOptions.h" class MenuRenderer { public: MenuRenderer(SDL_Renderer *renderer, SDL_Window *screen); bool showMenu(); virtual ~MenuRenderer(); private: void init(SDL_Renderer* renderer, SDL_Window *screen); int getTabIndex(Rocket::Core::Element* node); Rocket::Core::Element* getChildElementWithTabIndex(Rocket::Core::Element* parentNode, int tabIndex); Rocket::Core::Context* m_context = NULL; }; #endif /* MICKRENDERER_H_ */
/* * MenuRenderer.h * * Created on: Nov 18, 2016 * Author: msaun */ #ifndef MICKRENDERER_H_ #define MICKRENDERER_H_ #include <stdexcept> #include <string> #include "RuntimeException.h" #include <SDL2/SDL.h> #include <GL/glew.h> #include <Rocket/Core.h> #include <Rocket/Core/Input.h> #include <Rocket/Debugger/Debugger.h> #include "rocket/glue/SystemInterfaceSDL2.h" #include "rocket/glue/RenderInterfaceSDL2.h" #include "rocket/glue/ShellFileInterface.h" #include "rocket/MickRocketElementUtil.h" #include "GameSettings.h" #include "rocket/events/EventInstancer.h" #include "rocket/events/EventManager.h" #include "rocket/events/EventHandlerOptions.h" class MenuRenderer { public: MenuRenderer(SDL_Renderer *renderer, SDL_Window *screen); bool showMenu(); virtual ~MenuRenderer(); private: void init(SDL_Renderer* renderer, SDL_Window *screen); int getTabIndex(Rocket::Core::Element* node); Rocket::Core::Element* getChildElementWithTabIndex(Rocket::Core::Element* parentNode, int tabIndex); Rocket::Core::Context* m_context = NULL; }; #endif /* MICKRENDERER_H_ */
Fix compil on MSVC + WIN32
#ifndef MORTON_COMMON_H_ #define MORTON_COMMON_H_ #include <stdint.h> #if _MSC_VER #include <intrin.h> #endif inline bool findFirstSetBit32(const uint_fast32_t x, unsigned long* firstbit_location){ #if _MSC_VER return _BitScanReverse(firstbit_location, x); #elif __GNUC__ unsigned int pos = __builtin_ffs(x); firstbit_location = pos +1 ; return pos; #endif return true; } inline bool findFirstSetBit64(const uint_fast64_t x, unsigned long* firstbit_location){ #if _MSC_VER && _WIN64 return _BitScanReverse64(firstbit_location, x); #elif _MSC_VER && _WIN32 firstbit_location = 0; if (_BitScanReverse(&firstbit_location, (x >> 32))){ // check first part firstbit_location += 32; } else if ( ! _BitScanReverse(&firstbit_location, (x & 0xFFFFFFFF))){ // also test last part return 0; } return true; #elif __GNUC__ unsigned int pos = __builtin_ffs(x); first_bit_location = pos + 1; return pos; #endif return true; } #endif
#ifndef MORTON_COMMON_H_ #define MORTON_COMMON_H_ #include <stdint.h> #if _MSC_VER #include <intrin.h> #endif inline bool findFirstSetBit32(const uint_fast32_t x, unsigned long* firstbit_location){ #if _MSC_VER return _BitScanReverse(firstbit_location, x); #elif __GNUC__ unsigned int pos = __builtin_ffs(x); firstbit_location = pos +1 ; return pos; #endif return true; } inline bool findFirstSetBit64(const uint_fast64_t x, unsigned long* firstbit_location){ #if _MSC_VER && _WIN64 return _BitScanReverse64(firstbit_location, x); #elif _MSC_VER && _WIN32 firstbit_location = 0; if (_BitScanReverse(firstbit_location, (x >> 32))){ // check first part firstbit_location += 32; } else if ( ! _BitScanReverse(firstbit_location, (x & 0xFFFFFFFF))){ // also test last part return 0; } return true; #elif __GNUC__ unsigned int pos = __builtin_ffs(x); first_bit_location = pos + 1; return pos; #endif return true; } #endif
Remove hard tabs in .h file
/* * Copyright (c) 2012-2016 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #ifndef _VDP1_MAP_H_ #define _VDP1_MAP_H_ #include <scu-internal.h> /* Macros specific for processor */ #define VDP1(x) (0x25D00000 + (x)) /* Helpers specific to this processor */ #define TVMR 0x0000 #define FBCR 0x0002 #define PTMR 0x0004 #define EWDR 0x0006 #define EWLR 0x0008 #define EWRR 0x000A #define ENDR 0x000C #define EDSR 0x0010 #define LOPR 0x0012 #define COPR 0x0014 #define MODR 0x0016 #endif /* !_VDP1_MAP_H_ */
/* * Copyright (c) 2012-2016 Israel Jacquez * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com> */ #ifndef _VDP1_MAP_H_ #define _VDP1_MAP_H_ #include <scu-internal.h> /* Macros specific for processor */ #define VDP1(x) (0x25D00000 + (x)) /* Helpers specific to this processor */ #define TVMR 0x0000 #define FBCR 0x0002 #define PTMR 0x0004 #define EWDR 0x0006 #define EWLR 0x0008 #define EWRR 0x000A #define ENDR 0x000C #define EDSR 0x0010 #define LOPR 0x0012 #define COPR 0x0014 #define MODR 0x0016 #endif /* !_VDP1_MAP_H_ */
Adjust test to fix bot error from r254927.
// RUN: %clang -target x86_64-unknown-linux -O2 %s -flto=thin -c -o %t.o // RUN: llvm-lto -thinlto -o %t %t.o // Ensure clang -cc1 give expected error for incorrect input type // RUN: not %clang_cc1 -target x86_64-unknown-linux -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING // CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' // Ensure we get expected error for missing index file // RUN: %clang -target x86_64-unknown-linux -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR // CHECK-ERROR: Error loading index file 'bad.thinlto.bc': No such file or directory // Ensure Function Importing pass added // RUN: %clang -target x86_64-unknown-linux -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=%t.thinlto.bc -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-PASS // CHECK-PASS: Function Importing
// RUN: %clang -target x86_64-unknown-linux -O2 %s -flto=thin -c -o %t.o // RUN: llvm-lto -thinlto -o %t %t.o // Ensure clang -cc1 give expected error for incorrect input type // RUN: not %clang_cc1 -target x86_64-unknown-linux -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING // CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' // Ensure we get expected error for missing index file // RUN: %clang -target x86_64-unknown-linux -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR // CHECK-ERROR: Error loading index file 'bad.thinlto.bc' // Ensure Function Importing pass added // RUN: %clang -target x86_64-unknown-linux -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=%t.thinlto.bc -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-PASS // CHECK-PASS: Function Importing
Include member_keypair_TPM.h in omnibus include file.
/****************************************************************************** * * Copyright 2017 Xaptum, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License * *****************************************************************************/ #ifndef ECDAA_ECDAA_H #define ECDAA_ECDAA_H #pragma once #include <ecdaa/credential_ZZZ.h> #include <ecdaa/group_public_key_ZZZ.h> #include <ecdaa/issuer_keypair_ZZZ.h> #include <ecdaa/member_keypair_ZZZ.h> #include <ecdaa/prng.h> #include <ecdaa/revocations_ZZZ.h> #include <ecdaa/signature_ZZZ.h> #include <ecdaa/signature_TPM.h> #include <ecdaa/tpm_context.h> #endif
/****************************************************************************** * * Copyright 2017 Xaptum, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License * *****************************************************************************/ #ifndef ECDAA_ECDAA_H #define ECDAA_ECDAA_H #pragma once #include <ecdaa/credential_ZZZ.h> #include <ecdaa/group_public_key_ZZZ.h> #include <ecdaa/issuer_keypair_ZZZ.h> #include <ecdaa/member_keypair_ZZZ.h> #include <ecdaa/prng.h> #include <ecdaa/revocations_ZZZ.h> #include <ecdaa/signature_ZZZ.h> #include <ecdaa/member_keypair_TPM.h> #include <ecdaa/signature_TPM.h> #include <ecdaa/tpm_context.h> #endif
Set back the cursor and inputs visibility in the examples
#include <ConsoleControl.h> #include <ConsoleControlUtility.h> #include <ConsoleControlUI.h> #include <BasicExamples.h> int main() { const char* choices[] = { "Basic features", "UI features", "Exit", }; const cc_MenuColors colors = { BLACK, CYAN, BLACK, WHITE, BLACK, CYAN, BLACK }; cc_Menu menu; menu.title = "ConsoleControl Examples"; menu.choices = choices; menu.choicesNumber = 3; menu.choiceOnEscape = 2; menu.currentChoice = 0; bool loop = true; while(loop) { cc_displayColorMenu(&menu, &colors); cc_setColors(BLACK, WHITE); switch(menu.currentChoice) { case 0: basicExamples(); break; case 1: //TODO break; case 2: loop = false; break; default: break; } } return EXIT_SUCCESS; }
#include <ConsoleControl.h> #include <ConsoleControlUtility.h> #include <ConsoleControlUI.h> #include <BasicExamples.h> int main() { const char* choices[] = { "Basic features", "UI features", "Exit", }; const cc_MenuColors colors = { BLACK, CYAN, BLACK, WHITE, BLACK, CYAN, BLACK }; cc_Menu menu; menu.title = "ConsoleControl Examples"; menu.choices = choices; menu.choicesNumber = 3; menu.choiceOnEscape = 2; menu.currentChoice = 0; bool loop = true; while(loop) { cc_displayColorMenu(&menu, &colors); cc_setColors(BLACK, WHITE); switch(menu.currentChoice) { case 0: basicExamples(); break; case 1: //TODO break; case 2: loop = false; break; default: break; } } cc_setCursorVisibility(true); cc_displayInputs(true); return EXIT_SUCCESS; }
Test of rendering commands is now a bit more complex
/* $Id$ */ #include "GL/glc.h" #include <stdio.h> extern void my_init(void); extern void my_fini(void); void testQueso(void) { int ctx = 0; int font = 0; my_init(); ctx = glcGenContext(); glcContext(ctx); glcAppendCatalog("/usr/lib/X11/fonts/Type1"); glcFontFace(glcNewFontFromFamily(1, "Utopia"), "Bold"); font = glcNewFontFromFamily(2, "Courier"); glcFont(font); glcFontFace(font, "Italic"); glcRenderStyle(GLC_LINE); glScalef(24., 24., 0.); glTranslatef(100., 100., 0.); glColor3f(1., 1., 0.); glcRenderChar('A'); my_fini(); }
/* $Id$ */ #include "GL/glc.h" #include <stdio.h> extern void my_init(void); extern void my_fini(void); void testQueso(void) { int ctx = 0; int font = 0; my_init(); ctx = glcGenContext(); glcContext(ctx); glcAppendCatalog("/usr/lib/X11/fonts/Type1"); glcFontFace(glcNewFontFromFamily(1, "Utopia"), "Bold"); font = glcNewFontFromFamily(2, "Courier"); glcFont(font); glcFontFace(font, "Italic"); glcRenderStyle(GLC_TRIANGLE); glTranslatef(100., 100., 0.); glScalef(10., 10., 0.); glColor3f(1., 1., 0.); glcRenderChar('A'); glcRenderChar('l'); glTranslatef(-50., 100., 0.); glcRenderString("QuesoGLC"); my_fini(); }
Remove controls header (moved to SettingsTab)
#pragma once #include "../Controls/Controls.h" #include "SettingsTab.h" class OSD : public SettingsTab { public: OSD(HINSTANCE hInstance, LPCWSTR tabTemplate, LPCWSTR title = L""); virtual void SaveSettings(); protected: virtual void Initialize(); virtual void LoadSettings(); private: /* Controls: */ ListView *_osdList; GroupBox *_volumeGroup; Checkbox *_monitorVolEvents; ComboBox *_audioDevice; ComboBox *_audioTaper; //Slider Label *_limitValue; Checkbox *_forceLimit; GroupBox *_ejectGroup; Checkbox *_monitorEjectEvents; GroupBox *_keyboardGroup; Checkbox *_caps; Checkbox *_scroll; Checkbox *_num; Checkbox *_media; };
#pragma once #include "SettingsTab.h" class OSD : public SettingsTab { public: OSD(HINSTANCE hInstance, LPCWSTR tabTemplate, LPCWSTR title = L""); virtual void SaveSettings(); protected: virtual void Initialize(); virtual void LoadSettings(); private: /* Controls: */ ListView *_osdList; GroupBox *_volumeGroup; Checkbox *_monitorVolEvents; ComboBox *_audioDevice; ComboBox *_audioTaper; //Slider Label *_limitValue; Checkbox *_forceLimit; GroupBox *_ejectGroup; Checkbox *_monitorEjectEvents; GroupBox *_keyboardGroup; Checkbox *_caps; Checkbox *_scroll; Checkbox *_num; Checkbox *_media; };
Fix newline at end of file
/* * * Copyright 2015, Google Inc. * 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. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */
/* * * Copyright 2015, Google Inc. * 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. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */
Add code provided in class
#include <stdio.h> #include <stdlib.h> #include <pcap.h> int main() { struct pcap_if *found_devices; char errbuf[PCAP_ERRBUF_SIZE]; int success = 0; success = pcap_findalldevs(&found_devices, errbuf); if( success < 0 ) { printf("something went wrong. can't open device\n"); } if( found_devices != NULL ) { while( found_devices != NULL ) { printf("%s\n", found_devices->name); found_devices = found_devices->next; } } return 0; }
Add function to draw primitive circle
#ifndef _FAKE_LOCK_SCREEN_PATTERN_H_ #define _FAKE_LOCK_SCREEN_PATTERN_H_ #include <gtk/gtk.h> #if !GTK_CHECK_VERSION(3, 0, 0) typedef struct { gdouble red; gdouble green; gdouble blue; gdouble alpha; } GdkRGBA; #endif #endif
#ifndef _FAKE_LOCK_SCREEN_PATTERN_H_ #define _FAKE_LOCK_SCREEN_PATTERN_H_ #include <gtk/gtk.h> #if !GTK_CHECK_VERSION(3, 0, 0) typedef struct { gdouble red; gdouble green; gdouble blue; gdouble alpha; } GdkRGBA; #endif void flsp_draw_circle(cairo_t *context, gint x, gint y, gint radius, GdkRGBA circle, GdkRGBA border); #endif
Remove `HUBComponentIdentifier` import from umbrella header
/// Umbrella header for the Hub Framework #import "HUBManager.h" #import "HUBConnectivityStateResolver.h" // JSON #import "HUBJSONSchema.h" #import "HUBViewModelJSONSchema.h" #import "HUBComponentModelJSONSchema.h" #import "HUBComponentImageDataJSONSchema.h" #import "HUBJSONSchemaRegistry.h" #import "HUBJSONPath.h" #import "HUBMutableJSONPath.h" // Feature #import "HUBFeatureConfiguration.h" #import "HUBFeatureRegistry.h" // Content #import "HUBContentProviderFactory.h" #import "HUBRemoteContentProvider.h" #import "HUBLocalContentProvider.h" // View #import "HUBViewModel.h" #import "HUBViewModelLoader.h" #import "HUBViewModelLoaderFactory.h" #import "HUBViewModelBuilder.h" #import "HUBViewURIQualifier.h" #import "HUBViewControllerFactory.h" // Components #import "HUBComponent.h" #import "HUBComponentFactory.h" #import "HUBComponentIdentifier.h" #import "HUBComponentModel.h" #import "HUBComponentModelBuilder.h" #import "HUBComponentImageData.h" #import "HUBComponentImageDataBuilder.h" #import "HUBComponentRegistry.h"
/// Umbrella header for the Hub Framework #import "HUBManager.h" #import "HUBConnectivityStateResolver.h" // JSON #import "HUBJSONSchema.h" #import "HUBViewModelJSONSchema.h" #import "HUBComponentModelJSONSchema.h" #import "HUBComponentImageDataJSONSchema.h" #import "HUBJSONSchemaRegistry.h" #import "HUBJSONPath.h" #import "HUBMutableJSONPath.h" // Feature #import "HUBFeatureConfiguration.h" #import "HUBFeatureRegistry.h" // Content #import "HUBContentProviderFactory.h" #import "HUBRemoteContentProvider.h" #import "HUBLocalContentProvider.h" // View #import "HUBViewModel.h" #import "HUBViewModelLoader.h" #import "HUBViewModelLoaderFactory.h" #import "HUBViewModelBuilder.h" #import "HUBViewURIQualifier.h" #import "HUBViewControllerFactory.h" // Components #import "HUBComponent.h" #import "HUBComponentFactory.h" #import "HUBComponentModel.h" #import "HUBComponentModelBuilder.h" #import "HUBComponentImageData.h" #import "HUBComponentImageDataBuilder.h" #import "HUBComponentRegistry.h"
Add definition for testing bounds on array text
#! /usr/bin/tcc -run // demonstate testmin testmax consistency with malloc #include <string.h> // memcpy #include <stdio.h> // printf #include <stdlib.h> // malloc #include <assert.h> // assert typedef struct {ssize_t size; char *row; int count;} slot; slot line; slot *text; int main(void) { leng = 10; int numb; text = malloc(leng*sizeof(slot)); int textmax = (int) (text + leng - 1); int textmin = (int) (text + 0); line.row = NULL; line.size = 0; int i; for(i = 0; i < leng+1; i++) //deliberate overrun { printf("%d text = %p\n",i,text+i); numb = (int) (text+i); printf("%d numb = %x\n",i,numb); assert(textmin <= numb); assert(textmax >= numb); *(text+i) = line; } printf("test run ending\n"); return 0; }
#! /usr/bin/tcc -run #include <string.h> // memcpy #include <stdio.h> // printf #include <stdlib.h> // malloc #include <assert.h> // assert #define textbound texndx = (int) (text + iy); \ assert(textmin <= texndx); \ assert(textmax >= texndx); typedef struct {ssize_t size; char *row; int count;} slot; slot line; slot *text; int main(void) { int leng = 10; text = malloc(leng*sizeof(slot)); int textmax = (int) (text + leng - 1); int textmin = (int) (text + 0); line.row = NULL; line.size = 0; int iy; for(iy = 0; iy < leng+1; iy++) //deliberate iy overrun { printf("%d text = %p\n",iy,text+iy); int texndx; textbound; text[iy] = line; } printf("test run ending\n"); return 0; }
Add Depthbuffer to precompiled header
#include <Ogre.h> #include <OgreMeshFileFormat.h> #include <OgreOptimisedUtil.h> #include <OgrePredefinedControllers.h> #ifdef WIN32 #include <OgreD3D9RenderSystem.h> #include <OgreD3D9HLSLProgram.h> #endif #include <OgreOctreePlugin.h> #include <OgreOctreeSceneManager.h> #include <OgreCgPlugin.h> #include <OgreCgProgram.h>
#include <Ogre.h> #include <OgreDepthBuffer.h> #include <OgreMeshFileFormat.h> #include <OgreOptimisedUtil.h> #include <OgrePredefinedControllers.h> #ifdef WIN32 #include <OgreD3D9RenderSystem.h> #include <OgreD3D9HLSLProgram.h> #endif #include <OgreOctreePlugin.h> #include <OgreOctreeSceneManager.h> #include <OgreCgPlugin.h> #include <OgreCgProgram.h>
Change expecta equal() to accept any amount of argument
#import "Expecta.h" EXPMatcherInterface(_equal, (id expected)); EXPMatcherInterface(equal, (id expected)); // to aid code completion #define equal(expected) _equal(EXPObjectify((expected)))
#import "Expecta.h" EXPMatcherInterface(_equal, (id expected)); EXPMatcherInterface(equal, (id expected)); // to aid code completion #define equal(...) _equal(EXPObjectify((__VA_ARGS__)))
Revert "e logs - the custom e log func breaks eina backtraces, so don't use it"
#include "e.h" EINTERN int e_log_dom = -1; EINTERN int e_log_init(void) { e_log_dom = eina_log_domain_register("e", EINA_COLOR_WHITE); return e_log_dom != -1; } EINTERN int e_log_shutdown(void) { eina_log_domain_unregister(e_log_dom); e_log_dom = -1; return 0; }
#include "e.h" EINTERN int e_log_dom = -1; static const char *_names[] = { "CRI", "ERR", "WRN", "INF", "DBG", }; static void _e_log_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc EINA_UNUSED, int line, const char *fmt, void *data EINA_UNUSED, va_list args) { const char *color; color = eina_log_level_color_get(level); fprintf(stdout, "%s%s<" EINA_COLOR_RESET "%s%s>" EINA_COLOR_RESET "%s:%d" EINA_COLOR_RESET " ", color, _names[level > EINA_LOG_LEVEL_DBG ? EINA_LOG_LEVEL_DBG : level], d->domain_str, color, file, line); vfprintf(stdout, fmt, args); putc('\n', stdout); } EINTERN int e_log_init(void) { e_log_dom = eina_log_domain_register("e", EINA_COLOR_WHITE); eina_log_print_cb_set(_e_log_cb, NULL); return e_log_dom != -1; } EINTERN int e_log_shutdown(void) { eina_log_domain_unregister(e_log_dom); e_log_dom = -1; return 0; }
Revert new test from 213993.
// RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // CHECK-NGM: "-mno-global-merge" // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // CHECK-GM-NOT: "-mglobal-merge" // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mno-global-merge -c %s // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mglobal-merge -c %s
// RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // CHECK-NGM: "-mno-global-merge" // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // CHECK-GM-NOT: "-mglobal-merge"
Change world view distance to 3
#pragma once #include <boost/unordered_map.hpp> #include "System.h" #include "OpenSimplexNoise.h" enum class ChunkStatus { Generating, Alive, Dying, Dead }; typedef std::tuple<int64_t, int64_t, int64_t> ChunkKeyType; typedef std::tuple<ChunkStatus, IDType> ChunkContainerType; typedef boost::unordered_map<ChunkKeyType, ChunkContainerType> ChunksType; class World : public System { private: const uint8_t viewDistance = 5; const Point3 blockSize = Point3(1.0f); const glm::ivec3 chunkSize; OpenSimplexNoise noise = OpenSimplexNoise(std::random_device()()); Atomic<ChunksType> chunks; protected: void Init() override final; void Update(DeltaTicks &) override final; public: static bool IsSupported() { return true; } World(Polar *engine, const unsigned char chunkWidth, const unsigned char chunkHeight, const unsigned char chunkDepth) : System(engine), chunkSize(chunkWidth, chunkHeight, chunkDepth) {} ~World(); std::vector<bool> GenerateChunk(const Point3 &&) const; bool GenerateBlock(const Point3 &&) const; };
#pragma once #include <boost/unordered_map.hpp> #include "System.h" #include "OpenSimplexNoise.h" enum class ChunkStatus { Generating, Alive, Dying, Dead }; typedef std::tuple<int64_t, int64_t, int64_t> ChunkKeyType; typedef std::tuple<ChunkStatus, IDType> ChunkContainerType; typedef boost::unordered_map<ChunkKeyType, ChunkContainerType> ChunksType; class World : public System { private: const uint8_t viewDistance = 3; const Point3 blockSize = Point3(1.0f); const glm::ivec3 chunkSize; OpenSimplexNoise noise = OpenSimplexNoise(std::random_device()()); Atomic<ChunksType> chunks; protected: void Init() override final; void Update(DeltaTicks &) override final; public: static bool IsSupported() { return true; } World(Polar *engine, const unsigned char chunkWidth, const unsigned char chunkHeight, const unsigned char chunkDepth) : System(engine), chunkSize(chunkWidth, chunkHeight, chunkDepth) {} ~World(); std::vector<bool> GenerateChunk(const Point3 &&) const; bool GenerateBlock(const Point3 &&) const; };
Add test case for array and struct variable lvalue evaluation.
// RUN: clang -checker-simple -verify %s struct s {}; void f(void) { int a[10]; int (*p)[10]; p = &a; (*p)[3] = 1; struct s d; struct s *q; q = &d; }
Add test case for using mmintrin (and making sure that inlining is working with and without debug info).
// RUN: clang -triple i386-apple-darwin9 -emit-llvm -o %t %s && // RUN: grep define %t | count 1 && // RUN: clang -triple i386-apple-darwin9 -g -emit-llvm -o %t %s && // RUN: grep define %t | count 1 #include <mmintrin.h> #include <stdlib.h> int main(int argc, char *argv[]) { int array[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; __m64 *p = (__m64 *)array; __m64 accum = _mm_setzero_si64(); for (int i=0; i<8; ++i) accum = _mm_add_pi32(p[i], accum); __m64 accum2 = _mm_unpackhi_pi32(accum, accum); accum = _mm_add_pi32(accum, accum2); int result = _mm_cvtsi64_si32(accum); _mm_empty(); printf("%d\n", result ); return 0; }
Add some file utility functions
#pragma once #include "ionTypes.h" #include <algorithm> #include <numeric> #include <iomanip> #include <iostream> #include <fstream> #include <sstream> using std::move; using std::ifstream; template <typename T, typename U> U * ConditionalMapAccess(map<T, U *> & Map, T const Key) { auto Iterator = Map.find(Key); if (Iterator != Map.end()) return Iterator->second; return 0; }
#pragma once #include "ionTypes.h" #include <algorithm> #include <numeric> #include <iomanip> #include <iostream> #include <fstream> #include <sstream> using std::move; using std::ifstream; template <typename T, typename U> U * ConditionalMapAccess(map<T, U *> & Map, T const Key) { auto Iterator = Map.find(Key); if (Iterator != Map.end()) return Iterator->second; return 0; } class File { public: static bool Exists(string const & FileName) { ifstream ifile(FileName); return ifile.good(); } static string && ReadAsString(string const & FileName) { std::ifstream t(FileName); std::string str; t.seekg(0, std::ios::end); str.reserve((uint) t.tellg()); t.seekg(0, std::ios::beg); str.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>()); return move(str); } };
Fix comment at top of file to match file name.
/* File: connection.h * * Description: See "connection.c" * * Comments: See "notice.txt" for copyright and license information. * */ #ifndef __MD5_H__ #define __MD5_H__ #include "psqlodbc.h" #include <stdlib.h> #include <string.h> #ifdef WIN32 #define MD5_ODBC #define FRONTEND #endif #define MD5_PASSWD_LEN 35 /* From c.h */ #ifndef __BEOS__ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ #endif /* __BEOS__ */ #ifndef __BEOS__ /* this shouldn't be required, but is is! */ typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ #endif /* __BEOS__ */ extern bool EncryptMD5(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif
/* File: connection.h * * Description: See "md.h" * * Comments: See "notice.txt" for copyright and license information. * */ #ifndef __MD5_H__ #define __MD5_H__ #include "psqlodbc.h" #include <stdlib.h> #include <string.h> #ifdef WIN32 #define MD5_ODBC #define FRONTEND #endif #define MD5_PASSWD_LEN 35 /* From c.h */ #ifndef __BEOS__ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ #endif /* __BEOS__ */ #ifndef __BEOS__ /* this shouldn't be required, but is is! */ typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ #endif /* __BEOS__ */ extern bool EncryptMD5(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif
Add host info (add new files).
//===--- HostInfo.h - Host specific information -----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef CLANG_DRIVER_HOSTINFO,_H_ #define CLANG_DRIVER_HOSTINFO_H_ #include <string> namespace clang { namespace driver { class ArgList; class ToolChain; /// HostInfo - Config information about a particular host which may /// interact with driver behavior. /// /// The host information is used for controlling the parts of the /// driver which interact with the platform the driver is ostensibly /// being run from. For testing purposes, the HostInfo used by the /// driver may differ from the actual host. class HostInfo { std::string Arch, Platform, OS; protected: HostInfo(const char *Arch, const char *Platform, const char *OS); public: virtual ~HostInfo(); /// useDriverDriver - Whether the driver should act as a driver /// driver for this host and support -arch, -Xarch, etc. virtual bool useDriverDriver() const = 0; /// getToolChain - Construct the toolchain to use for this host. /// /// \param Args - The argument list, which may be used to alter the /// default toolchain, for example in the presence of -m32 or -m64. /// /// \param ArchName - The architecture to return a toolchain for, or /// 0 if unspecified. This will only be non-zero for hosts which /// support a driver driver. virtual ToolChain *getToolChain(const ArgList &Args, const char *ArchName) const = 0; }; /// DarwinHostInfo - Darwin host information implementation. class DarwinHostInfo : public HostInfo { /// Darwin version of host. unsigned DarwinVersion[3]; /// GCC version to use on this host. unsigned GCCVersion[3]; public: DarwinHostInfo(const char *Arch, const char *Platform, const char *OS); virtual bool useDriverDriver() const; virtual ToolChain *getToolChain(const ArgList &Args, const char *ArchName) const; }; /// UnknownHostInfo - Generic host information to use for unknown /// hosts. class UnknownHostInfo : public HostInfo { public: UnknownHostInfo(const char *Arch, const char *Platform, const char *OS); virtual bool useDriverDriver() const; virtual ToolChain *getToolChain(const ArgList &Args, const char *ArchName) const; }; } // end namespace driver } // end namespace clang #endif
Solve Trinomial Triangle in c
#include <stdio.h> #include <string.h> unsigned long long memo[1000]; unsigned long long calculate_sum(unsigned long long line) { if (memo[line] != 0) { return memo[line]; } if (line == 0) { memo[line] = 1; } else { memo[line] = calculate_sum(line - 1) * 3; } return memo[line]; } int main() { unsigned long long line; memset(memo, 0, sizeof(memo)); while(scanf("%llu", &line) != EOF) { printf("%llu\n", calculate_sum(line)); } return 0; }
Add BackupInfo class to public include header
// // ObjectiveRocks.h // ObjectiveRocks // // Created by Iska on 20/11/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import "RocksDB.h" #import "RocksDBColumnFamily.h" #import "RocksDBOptions.h" #import "RocksDBReadOptions.h" #import "RocksDBWriteOptions.h" #import "RocksDBWriteBatch.h" #import "RocksDBIterator.h" #import "RocksDBSnapshot.h" #import "RocksDBComparator.h" #import "RocksDBMergeOperator.h" #import "RocksDBBackupEngine.h" #import "RocksDBTypes.h" #import "RocksDBError.h"
// // ObjectiveRocks.h // ObjectiveRocks // // Created by Iska on 20/11/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import "RocksDB.h" #import "RocksDBColumnFamily.h" #import "RocksDBOptions.h" #import "RocksDBReadOptions.h" #import "RocksDBWriteOptions.h" #import "RocksDBWriteBatch.h" #import "RocksDBIterator.h" #import "RocksDBSnapshot.h" #import "RocksDBComparator.h" #import "RocksDBMergeOperator.h" #import "RocksDBBackupEngine.h" #import "RocksDBBackupInfo.h" #import "RocksDBTypes.h" #import "RocksDBError.h"
Rename our struct statvfs to struct ustatvfs to prevent libc name collision.
/* * License: BSD-style license * Copyright: Radek Podgorny <radek@podgorny.cz>, * Bernd Schubert <bernd-schubert@gmx.de> */ #ifndef UNIONFS_H #define UNIONFS_H #define PATHLEN_MAX 1024 #define HIDETAG "_HIDDEN~" #define METADIR ".unionfs/" typedef struct { char *path; int fd; // used to prevent accidental umounts of path unsigned char rw; // the writable flag } branch_entry_t; /** * structure to have information about the current union */ typedef struct { // read-writable branches struct rw_branches { int n_rw; // number of rw-branches unsigned *rw_br; // integer array of rw-branches } rw_branches; // branches used for statfs struct statvfs { int nbranches; // number of statvfs branches int *branches; // array of integers with the branch numbers } statvfs; } ufeatures_t; extern ufeatures_t ufeatures; #endif
/* * License: BSD-style license * Copyright: Radek Podgorny <radek@podgorny.cz>, * Bernd Schubert <bernd-schubert@gmx.de> */ #ifndef UNIONFS_H #define UNIONFS_H #define PATHLEN_MAX 1024 #define HIDETAG "_HIDDEN~" #define METADIR ".unionfs/" typedef struct { char *path; int fd; // used to prevent accidental umounts of path unsigned char rw; // the writable flag } branch_entry_t; /** * structure to have information about the current union */ typedef struct { // read-writable branches struct rw_branches { int n_rw; // number of rw-branches unsigned *rw_br; // integer array of rw-branches } rw_branches; // branches used for statfs struct ustatvfs { int nbranches; // number of statvfs branches int *branches; // array of integers with the branch numbers } statvfs; } ufeatures_t; extern ufeatures_t ufeatures; #endif
Add more Ochoness to Bitcoin.
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_CONSENSUS_H #define BITCOIN_CONSENSUS_CONSENSUS_H /** The maximum allowed size for a serialized block, in bytes (network rule) */ static const unsigned int MAX_BLOCK_SIZE = 1000000; /** The maximum allowed number of signature check operations in a block (network rule) */ static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50; /** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */ static const int COINBASE_MATURITY = 100; /** Flags for nSequence and nLockTime locks */ enum { /* Interpret sequence numbers as relative lock-time constraints. */ LOCKTIME_VERIFY_SEQUENCE = (1 << 0), /* Use GetMedianTimePast() instead of nTime for end point timestamp. */ LOCKTIME_MEDIAN_TIME_PAST = (1 << 1), }; #endif // BITCOIN_CONSENSUS_CONSENSUS_H
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2016 The Bitcoin Ocho developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_CONSENSUS_H #define BITCOIN_CONSENSUS_CONSENSUS_H /** The maximum allowed size for a serialized block, in bytes (network rule) */ /** Bitcoin Ocho, we multiply by 8 for Ocho */ static const unsigned int MAX_BLOCK_SIZE = 1000000*8; /** The maximum allowed number of signature check operations in a block (network rule) */ static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50; /** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */ static const int COINBASE_MATURITY = 100; /** Flags for nSequence and nLockTime locks */ enum { /* Interpret sequence numbers as relative lock-time constraints. */ LOCKTIME_VERIFY_SEQUENCE = (1 << 0), /* Use GetMedianTimePast() instead of nTime for end point timestamp. */ LOCKTIME_MEDIAN_TIME_PAST = (1 << 1), }; #endif // BITCOIN_CONSENSUS_CONSENSUS_H
Tweak the DejaGNU voodoo to match Bill's advice.
// RUN: $llvmgcc $test -c -o /dev/null |& \ // RUN: egrep {(14|15|22): warning:} | \ // RUN: wc -l | grep --quiet 3 // TARGET: *-*-darwin // XFAIL: alpha|ia64|sparc // END. // Insist upon warnings for inappropriate weak attributes. // Note the line numbers (14|15|22) embedded in the check. // O.K. extern int ext_weak_import __attribute__ ((__weak_import__)); // These are inappropriate, and should generate warnings: int decl_weak_import __attribute__ ((__weak_import__)); int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13; // O.K. extern int ext_f(void) __attribute__ ((__weak_import__)); // These are inappropriate, and should generate warnings: int def_f(void) __attribute__ ((__weak_import__)); int __attribute__ ((__weak_import__)) decl_f(void) {return 0;};
// RUN: $llvmgcc $test -c -o /dev/null |& \ // RUN: egrep {(14|15|22): warning:} | \ // RUN: wc -l | grep --quiet 3 // XTARGET: darwin // XFAIL: * // END. // Insist upon warnings for inappropriate weak attributes. // Note the line numbers (14|15|22) embedded in the check. // O.K. extern int ext_weak_import __attribute__ ((__weak_import__)); // These are inappropriate, and should generate warnings: int decl_weak_import __attribute__ ((__weak_import__)); int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13; // O.K. extern int ext_f(void) __attribute__ ((__weak_import__)); // These are inappropriate, and should generate warnings: int def_f(void) __attribute__ ((__weak_import__)); int __attribute__ ((__weak_import__)) decl_f(void) {return 0;};
Fix comment typo in test.
@import import_self.c; #include "import-self-d.h" // FIXME: This should not work; names from 'a' should not be visible here. MyTypeA import_self_test_a; // FIXME: This should work but does not; names from 'b' are not actually visible here. //MyTypeC import_self_test_c; MyTypeD import_self_test_d;
// FIXME: This import has no effect, because the submodule isn't built yet, and // we don't map an @import to a #include in this case. @import import_self.c; #include "import-self-d.h" // FIXME: This should not work; names from 'a' should not be visible here. MyTypeA import_self_test_a; // FIXME: This should work but does not; names from 'c' are not actually visible here. //MyTypeC import_self_test_c; MyTypeD import_self_test_d;
Fix compile error under boost 1.38, caused by boost/random.hpp seed()
/** * @file RandGenerator.h * @brief generate random item ids * @author Jun Jiang * @date 2011-11-30 */ #ifndef RAND_GENERATOR_H #define RAND_GENERATOR_H #include <util/ThreadModel.h> #include <boost/random.hpp> namespace sf1r { template<typename ValueType = int, typename Distribution = boost::uniform_int<ValueType>, typename Engine = boost::mt19937, typename LockType = izenelib::util::ReadWriteLock> class RandGenerator { public: RandGenerator() : generator_(Engine(), Distribution()) {} void seed(int value) { ScopedWriteLock lock(lock_); generator_.engine().seed(value); } ValueType generate(ValueType min, ValueType max) { ScopedWriteLock lock(lock_); Distribution& dist = generator_.distribution(); if (dist.min() != min || dist.max() != max) { dist = Distribution(min, max); } return generator_(); } private: typedef boost::variate_generator<Engine, Distribution> Generator; Generator generator_; typedef izenelib::util::ScopedWriteLock<LockType> ScopedWriteLock; LockType lock_; }; } // namespace sf1r #endif // RAND_GENERATOR_H
/** * @file RandGenerator.h * @brief generate random item ids * @author Jun Jiang * @date 2011-11-30 */ #ifndef RAND_GENERATOR_H #define RAND_GENERATOR_H #include <util/ThreadModel.h> #include <boost/random.hpp> namespace sf1r { template<typename ValueType = int, typename Distribution = boost::uniform_int<ValueType>, typename Engine = boost::mt19937, typename LockType = izenelib::util::ReadWriteLock> class RandGenerator { public: RandGenerator() : generator_(Engine(), Distribution()) {} void seed(unsigned int value) { ScopedWriteLock lock(lock_); Engine& engine = generator_.engine(); engine.seed(value); } ValueType generate(ValueType min, ValueType max) { ScopedWriteLock lock(lock_); Distribution& dist = generator_.distribution(); if (dist.min() != min || dist.max() != max) { dist = Distribution(min, max); } return generator_(); } private: typedef boost::variate_generator<Engine, Distribution> Generator; Generator generator_; typedef izenelib::util::ScopedWriteLock<LockType> ScopedWriteLock; LockType lock_; }; } // namespace sf1r #endif // RAND_GENERATOR_H
Add the state definitions for Task.
#ifndef _TPOOL_TASK_BASE_H_ #define _TPOOL_TASK_BASE_H_ #include <boost/shared_ptr.hpp> namespace tpool { class TaskBase { public: typedef boost::shared_ptr<TaskBase> Ptr; ~TaskBase() {} virtual void Do() = 0; }; } #endif
#ifndef _TPOOL_TASK_BASE_H_ #define _TPOOL_TASK_BASE_H_ #include <boost/shared_ptr.hpp> namespace tpool { class TaskBase { public: typedef boost::shared_ptr<TaskBase> Ptr; enum State { INIT, RUNNING, FINISHED, CANCELED, }; ~TaskBase() {} virtual void Do() = 0; virtual State GetState() const; }; } #endif
Add write memory barrier for aarch64
/* Copyright (c) 2013, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ /** * @file * * ODP synchronisation */ #ifndef ODP_SYNC_H_ #define ODP_SYNC_H_ #ifdef __cplusplus extern "C" { #endif /** * Synchronise stores * * Ensures that all CPU store operations that precede the odp_sync_stores() * call are globally visible before any store operation that follows it. */ static inline void odp_sync_stores(void) { #if defined __x86_64__ || defined __i386__ __asm__ __volatile__ ("sfence\n" : : : "memory"); #elif defined __arm__ __asm__ __volatile__ ("dmb st" : : : "memory"); #elif defined __OCTEON__ __asm__ __volatile__ ("syncws\n" : : : "memory"); #else __sync_synchronize(); #endif } #ifdef __cplusplus } #endif #endif
/* Copyright (c) 2013, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ /** * @file * * ODP synchronisation */ #ifndef ODP_SYNC_H_ #define ODP_SYNC_H_ #ifdef __cplusplus extern "C" { #endif /** * Synchronise stores * * Ensures that all CPU store operations that precede the odp_sync_stores() * call are globally visible before any store operation that follows it. */ static inline void odp_sync_stores(void) { #if defined __x86_64__ || defined __i386__ __asm__ __volatile__ ("sfence\n" : : : "memory"); #elif defined __arm__ || defined __aarch64__ __asm__ __volatile__ ("dmb st" : : : "memory"); #elif defined __OCTEON__ __asm__ __volatile__ ("syncws\n" : : : "memory"); #else __sync_synchronize(); #endif } #ifdef __cplusplus } #endif #endif
Update headers to match new printf
#ifndef KPUTS_H #define KPUTS_H #include "drivers/terminal.h" void kputs(char* string); void kprint_int(char* string, int i); #endif
#ifndef KPUTS_H #define KPUTS_H #include <stdarg.h> #include "drivers/terminal.h" void kputs(char* string); void kprintf(char* string, ...); #endif
Delete unused extern variable declared
#ifndef GRIDCELL_H #define GRIDCELL_H #include <gsl/gsl_rng.h> /* DATA STRUCTURES */ #define GC_NUM_STATES 4 typedef enum { DECIDUOUS,CONIFEROUS,TRANSITIONAL,MIXED} State; typedef double StateData [GC_NUM_STATES]; typedef enum { MOORE, VONNE} NeighType; extern State GC_POSSIBLE_STATES [GC_NUM_STATES]; // this is an array giving all possible states typedef struct { double meanTemp; /*Task: list all variables need to be used*/ // Fill later } Climate; typedef struct { State* currentState; State* stateHistory; Climate climate; StateData prevalence; StateData transitionProbs; size_t historySize; } GridCell; /*. FUNCTION PROTOTYPES */ GridCell* gc_make_cell (size_t numTimeSteps); // allocate memory and null initialize cell, initialize pointers void gc_get_trans_prob (GridCell* cell); void gc_select_new_state (GridCell* cell, gsl_rng* rng); void gc_destroy_cell(GridCell *cell); #endif
#ifndef GRIDCELL_H #define GRIDCELL_H #include <gsl/gsl_rng.h> /* DATA STRUCTURES */ #define GC_NUM_STATES 4 typedef enum { DECIDUOUS,CONIFEROUS,TRANSITIONAL,MIXED} State; typedef double StateData [GC_NUM_STATES]; typedef enum { MOORE, VONNE} NeighType; typedef struct { double meanTemp; /*Task: list all variables need to be used*/ // Fill later } Climate; typedef struct { State* currentState; State* stateHistory; Climate climate; StateData prevalence; StateData transitionProbs; size_t historySize; } GridCell; /*. FUNCTION PROTOTYPES */ GridCell* gc_make_cell (size_t numTimeSteps); // allocate memory and null initialize cell, initialize pointers void gc_get_trans_prob (GridCell* cell); void gc_select_new_state (GridCell* cell, gsl_rng* rng); void gc_destroy_cell(GridCell *cell); #endif
Set more rare GUI update
#ifndef GUICONSTANTS_H #define GUICONSTANTS_H /* Milliseconds between model updates */ static const int MODEL_UPDATE_DELAY = 500; /* AskPassphraseDialog -- Maximum passphrase length */ static const int MAX_PASSPHRASE_SIZE = 1024; /* CubitsGUI -- Size of icons in status bar */ static const int STATUSBAR_ICONSIZE = 16; /* Invalid field background style */ #define STYLE_INVALID "background:#FF8080" /* Transaction list -- unconfirmed transaction */ #define COLOR_UNCONFIRMED QColor(128, 128, 128) /* Transaction list -- negative amount */ #define COLOR_NEGATIVE QColor(255, 0, 0) /* Transaction list -- bare address (without label) */ #define COLOR_BAREADDRESS QColor(140, 140, 140) /* Tooltips longer than this (in characters) are converted into rich text, so that they can be word-wrapped. */ static const int TOOLTIP_WRAP_THRESHOLD = 80; /* Maximum allowed URI length */ static const int MAX_URI_LENGTH = 255; /* QRCodeDialog -- size of exported QR Code image */ #define EXPORT_IMAGE_SIZE 256 #endif // GUICONSTANTS_H
#ifndef GUICONSTANTS_H #define GUICONSTANTS_H /* Milliseconds between model updates */ static const int MODEL_UPDATE_DELAY = 5000; /* AskPassphraseDialog -- Maximum passphrase length */ static const int MAX_PASSPHRASE_SIZE = 1024; /* CubitsGUI -- Size of icons in status bar */ static const int STATUSBAR_ICONSIZE = 16; /* Invalid field background style */ #define STYLE_INVALID "background:#FF8080" /* Transaction list -- unconfirmed transaction */ #define COLOR_UNCONFIRMED QColor(128, 128, 128) /* Transaction list -- negative amount */ #define COLOR_NEGATIVE QColor(255, 0, 0) /* Transaction list -- bare address (without label) */ #define COLOR_BAREADDRESS QColor(140, 140, 140) /* Tooltips longer than this (in characters) are converted into rich text, so that they can be word-wrapped. */ static const int TOOLTIP_WRAP_THRESHOLD = 80; /* Maximum allowed URI length */ static const int MAX_URI_LENGTH = 255; /* QRCodeDialog -- size of exported QR Code image */ #define EXPORT_IMAGE_SIZE 256 #endif // GUICONSTANTS_H
Add missing file for the MPI test.
#include <stdio.h> #include <stdlib.h> #include <mpi.h> int main (int argc, char *argv[]) { int rank, size, length; char name[BUFSIZ]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Get_processor_name (name, &length); printf ("%s: hello world from process %d of %d\n", name, rank, size); MPI_Finalize (); return EXIT_SUCCESS; }
Add a basic implementation of class CycleTimer
// (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_CYCLETIMER_H #define TESSERACT_UNITTEST_CYCLETIMER_H #include "absl/time/clock.h" // for GetCurrentTimeNanos // See https://github.com/google/or-tools/blob/master/ortools/base/timer.h class CycleTimer { public: CycleTimer() { Reset(); } void Reset() { running_ = false; sum_ = 0; } // When Start() is called multiple times, only the most recent is used. void Start() { running_ = true; start_ = absl::GetCurrentTimeNanos(); } void Restart() { sum_ = 0; Start(); } void Stop() { if (running_) { sum_ += absl::GetCurrentTimeNanos() - start_; running_ = false; } } int64_t GetInMs() const { return GetNanos() / 1000000; } protected: int64_t GetNanos() const { return running_ ? absl::GetCurrentTimeNanos() - start_ + sum_ : sum_; } private: bool running_; int64_t start_; int64_t sum_; }; #endif // TESSERACT_UNITTEST_CYCLETIMER_H
Fix ifdef for serial port header file
#ifndef TR_HUB_SERIAL_PORT_H #define TR_HUB_SERIAL_PORT_H #include <stdio.h> // Standard input/output definitions #include <string.h> // String function definitions #include <unistd.h> // UNIX standard function definitions #include <fcntl.h> // File control definitions #include <errno.h> // Error number definitions #include <termios.h> // POSIX terminal control definitions #include <sys/ioctl.h> #include <boost/thread.hpp> #include <boost/function.hpp> #include <string> namespace tr_hub_parser { class SerialPort { public: SerialPort(); virtual ~SerialPort(); bool connect(const std::string port); void disconnect(); bool sendChar(const char c[]); void setSerialCallbackFunction(boost::function<void(uint8_t)> *f); void serialThread(); int serial_port_fd_; boost::thread serial_thread_; bool serial_thread_should_exit_; boost::function<void(uint8_t)> * serial_callback_function; }; } // namespace tr_hub_parser #endif // TR_HUB_SERIAL_PORT_H
#ifndef TERARANGER_HUB_SERIAL_PORT_H #define TERARANGER_HUB_SERIAL_PORT_H #include <stdio.h> // Standard input/output definitions #include <string.h> // String function definitions #include <unistd.h> // UNIX standard function definitions #include <fcntl.h> // File control definitions #include <errno.h> // Error number definitions #include <termios.h> // POSIX terminal control definitions #include <sys/ioctl.h> #include <boost/thread.hpp> #include <boost/function.hpp> #include <string> namespace tr_hub_parser { class SerialPort { public: SerialPort(); virtual ~SerialPort(); bool connect(const std::string port); void disconnect(); bool sendChar(const char c[]); void setSerialCallbackFunction(boost::function<void(uint8_t)> *f); void serialThread(); int serial_port_fd_; boost::thread serial_thread_; bool serial_thread_should_exit_; boost::function<void(uint8_t)> * serial_callback_function; }; } // namespace tr_hub_parser #endif // TERARANGER_HUB_SERIAL_PORT_H
Remove unused __VERIFIER_assert definition from nofun test
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); extern int __VERIFIER_nondet_int(); void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: __VERIFIER_error(); } return; } int main() { int x, y; if (__VERIFIER_nondet_int()) { x = 0; y = 1; } else { x = 1; y = 0; } // if (!(x + y == 1)) if (x + y != 1) __VERIFIER_error(); return 0; }
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); extern int __VERIFIER_nondet_int(); int main() { int x, y; if (__VERIFIER_nondet_int()) { x = 0; y = 1; } else { x = 1; y = 0; } // if (!(x + y == 1)) if (x + y != 1) __VERIFIER_error(); return 0; }
Add support for static lib
#ifndef QTYAML_GLOBAL_H #define QTYAML_GLOBAL_H #include <QtCore/QtGlobal> #if defined(QTYAML_LIBRARY) # define QTYAMLSHARED_EXPORT Q_DECL_EXPORT #else # define QTYAMLSHARED_EXPORT Q_DECL_IMPORT #endif #endif // QTYAML_GLOBAL_H
#ifndef QTYAML_GLOBAL_H #define QTYAML_GLOBAL_H #include <QtCore/QtGlobal> #ifdef YAML_DECLARE_STATIC # define QTYAMLSHARED_EXPORT #else # ifdef QTYAML_LIBRARY # define QTYAMLSHARED_EXPORT Q_DECL_EXPORT # else # define QTYAMLSHARED_EXPORT Q_DECL_IMPORT # endif #endif #endif // QTYAML_GLOBAL_H
Add support for charset attribute and Latin1 encoding.
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #ifdef __cplusplus extern "C" { #endif #ifndef HTMLLEX_H #define HTMLLEX_H #include <agxbuf.h> extern int initHTMLlexer(char *, agxbuf *); extern int htmllex(void); extern int htmllineno(void); extern int clearHTMLlexer(void); void htmlerror(const char *); #endif #ifdef __cplusplus } #endif
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #ifdef __cplusplus extern "C" { #endif #ifndef HTMLLEX_H #define HTMLLEX_H #include <agxbuf.h> extern int initHTMLlexer(char *, agxbuf *, int); extern int htmllex(void); extern int htmllineno(void); extern int clearHTMLlexer(void); void htmlerror(const char *); #endif #ifdef __cplusplus } #endif
Mark _slave_entry to never return
/* * Copyright (c) 2012-2016 * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com */ #include <sys/cdefs.h> #include <smpc/smc.h> #include <cpu/instructions.h> #include <cpu/frt.h> #include <cpu/intc.h> #include <cpu/map.h> #include <cpu/slave.h> static void _slave_entry(void); static void _default_entry(void); static void (*_entry)(void) = _default_entry; void cpu_slave_init(void) { smpc_smc_sshoff_call(); cpu_slave_entry_clear(); cpu_intc_ihr_set(INTC_INTERRUPT_SLAVE_ENTRY, _slave_entry); smpc_smc_sshon_call(); } void cpu_slave_entry_set(void (*entry)(void)) { _entry = (entry != NULL) ? entry : _default_entry; } static void _slave_entry(void) { while (true) { while (((cpu_frt_status_get()) & FRTCS_ICF) == 0x00); cpu_frt_control_chg((uint8_t)~FRTCS_ICF); _entry(); } } static void _default_entry(void) { }
/* * Copyright (c) 2012-2016 * See LICENSE for details. * * Israel Jacquez <mrkotfw@gmail.com */ #include <sys/cdefs.h> #include <smpc/smc.h> #include <cpu/instructions.h> #include <cpu/frt.h> #include <cpu/intc.h> #include <cpu/map.h> #include <cpu/slave.h> static void _slave_entry(void); static void _default_entry(void); static void (*_entry)(void) = _default_entry; void cpu_slave_init(void) { smpc_smc_sshoff_call(); cpu_slave_entry_clear(); cpu_intc_ihr_set(INTC_INTERRUPT_SLAVE_ENTRY, _slave_entry); smpc_smc_sshon_call(); } void cpu_slave_entry_set(void (*entry)(void)) { _entry = (entry != NULL) ? entry : _default_entry; } static void __noreturn _slave_entry(void) { while (true) { while (((cpu_frt_status_get()) & FRTCS_ICF) == 0x00); cpu_frt_control_chg((uint8_t)~FRTCS_ICF); _entry(); } } static void _default_entry(void) { }
Add definitions for the Dallas DS1742 RTC / non-volatile memory.
/* * ds1742rtc.h - register definitions for the Real-Time-Clock / CMOS RAM * * Copyright (C) 1999-2001 Toshiba Corporation * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org) * * Permission is hereby granted to copy, modify and redistribute this code * in terms of the GNU Library General Public License, Version 2 or later, * at your option. */ #ifndef __LINUX_DS1742RTC_H #define __LINUX_DS1742RTC_H #include <asm/ds1742.h> #define RTC_BRAM_SIZE 0x800 #define RTC_OFFSET 0x7f8 /* * Register summary */ #define RTC_CONTROL (RTC_OFFSET + 0) #define RTC_CENTURY (RTC_OFFSET + 0) #define RTC_SECONDS (RTC_OFFSET + 1) #define RTC_MINUTES (RTC_OFFSET + 2) #define RTC_HOURS (RTC_OFFSET + 3) #define RTC_DAY (RTC_OFFSET + 4) #define RTC_DATE (RTC_OFFSET + 5) #define RTC_MONTH (RTC_OFFSET + 6) #define RTC_YEAR (RTC_OFFSET + 7) #define RTC_CENTURY_MASK 0x3f #define RTC_SECONDS_MASK 0x7f #define RTC_DAY_MASK 0x07 /* * Bits in the Control/Century register */ #define RTC_WRITE 0x80 #define RTC_READ 0x40 /* * Bits in the Seconds register */ #define RTC_STOP 0x80 /* * Bits in the Day register */ #define RTC_BATT_FLAG 0x80 #define RTC_FREQ_TEST 0x40 #endif /* __LINUX_DS1742RTC_H */
Use // not ; since this is C.
; PR 1332 ; RUN: %llvmgcc %s -S -o /dev/null struct Z { int a:1; int :0; int c:1; } z;
// PR 1332 // RUN: %llvmgcc %s -S -o /dev/null struct Z { int a:1; int :0; int c:1; } z;
Remove TODO about making WrenchMenuObserver an inner class of WrenchMenu.
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_OBSERVER_H_ #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_OBSERVER_H_ // TODO(gbillock): Make this an inner class of WrenchMenu. (even needed?) class WrenchMenuObserver { public: // Invoked when the WrenchMenu is about to be destroyed (from its destructor). virtual void WrenchMenuDestroyed() = 0; protected: virtual ~WrenchMenuObserver() {} }; #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_OBSERVER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_OBSERVER_H_ #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_OBSERVER_H_ class WrenchMenuObserver { public: // Invoked when the WrenchMenu is about to be destroyed (from its destructor). virtual void WrenchMenuDestroyed() = 0; protected: virtual ~WrenchMenuObserver() {} }; #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_MENU_OBSERVER_H_
Sort includes in alphabetical order
/** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Header file containing strided array type definitions. */ #ifndef STDLIB_STRIDED_TYPEDEFS_H #define STDLIB_STRIDED_TYPEDEFS_H #include "strided_nullary_typedefs.h" #include "strided_unary_typedefs.h" #include "strided_binary_typedefs.h" #include "strided_ternary_typedefs.h" #include "strided_quaternary_typedefs.h" #include "strided_quinary_typedefs.h" #endif // !STDLIB_STRIDED_TYPEDEFS_H
/** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Header file containing strided array type definitions. */ #ifndef STDLIB_STRIDED_TYPEDEFS_H #define STDLIB_STRIDED_TYPEDEFS_H // Note: keep in alphabetical order... #include "strided_binary_typedefs.h" #include "strided_nullary_typedefs.h" #include "strided_quaternary_typedefs.h" #include "strided_quinary_typedefs.h" #include "strided_ternary_typedefs.h" #include "strided_unary_typedefs.h" #endif // !STDLIB_STRIDED_TYPEDEFS_H
Define a potential header for interop functions
/* * Copyright (c) 2016, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef TRUFFLE_H #define TRUFFLE_H #if defined(__cplusplus) extern "C" { #endif #include <stdbool.h> void *truffle_import(const char *name); void truffle_export(const char *name, void *value); bool truffle_is_executable(void *object); void *truffle_execute(void *object, ...); void *truffle_invoke(void *object, const char *name, ...); bool truffle_has_size(void *object); void *truffle_get_size(void *object); bool truffle_is_boxed(void *object); void *truffle_unbox(void *object); bool truffle_is_null(void *object); void *truffle_read(void *object, void *name); void truffle_write(void *object, void *name, void *value); #if defined(__cplusplus) } #endif #endif
Implement a simple queue for network events
#pragma once #include <mutex> #include "throw_assert.h" #include <pair> #include <utility> namespace Core { // Simple multiple writer siingle reader queue implementation with infinite growth template <class Collection> class MWSRQueue { public: using T = Collection::value_type; void push_back(T&& it) { { std::unique_lock lock(_mx); coll.push_back(std::move(it)); } waitrd.notify_one(); } std::pair<bool, T> pop_front() { std::unique_lock lock(_mx); while (!coll.size() && !_killFlag) waitrd.wait(lock); if (_killFlag) return {false, T()}; throw_assert(coll.size() > 0, "There should be at least one element in the queue"); T ret = std::move(coll.front()); coll.pop_front(); lock.unlock(); return {true, std::move(ret)}; } void kill() { { std::unique_lock lock(_mx); _killFlag = true; } waitrd.notify_all(); } private: std::mutex _mx; std::condition_variable _waitrd; Collection _coll; bool _killFlag = false; }; }
Implement temperature program with a for loop
#include <stdio.h> /* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ int main(void) { float fahr, celsius; int lower, upper, step; lower = 0; // lower limit of temperature table upper = 300; // upper limit step = 20; // step size printf("Fahrenheit-Celsius Table\n\n"); fahr = lower; while (fahr <= upper) { celsius = (5.0/9.0) * (fahr-32.0); printf("%3.0f %6.1f\n", fahr, celsius); fahr = fahr + step; } }
#include <stdio.h> /* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ // int main(void) // { // float fahr, celsius; // int lower, upper, step; // lower = 0; // lower limit of temperature table // upper = 300; // upper limit // step = 20; // step size // printf("Fahrenheit-Celsius Table\n\n"); // fahr = lower; // while (fahr <= upper) { // celsius = (5.0/9.0) * (fahr-32.0); // printf("%3.0f %6.1f\n", fahr, celsius); // fahr = fahr + step; // } // } int main(void) { for(int fahr = 0; fahr <= 300; fahr = fahr + 20) { printf("%3d %6.1f\n", fahr, (5.0/9.0) * (fahr-32)); } }
Fix export decoration of Lua module
#ifdef __cplusplus extern "C" { #endif #include "lua.h" #ifdef __cplusplus } #endif #include "lualcm_lcm.h" #include "lualcm_hash.h" #include "lualcm_pack.h" int luaopen_lcm_lcm(lua_State* L) { ll_lcm_makemetatable(L); ll_lcm_register_new(L); return 1; } int luaopen_lcm__hash(lua_State* L) { ll_hash_makemetatable(L); ll_hash_register_new(L); return 1; } int luaopen_lcm__pack(lua_State* L) { ll_pack_register(L); return 1; } int luaopen_lcm(lua_State* L) { lua_newtable(L); lua_pushstring(L, "lcm"); luaopen_lcm_lcm(L); lua_rawset(L, -3); lua_pushstring(L, "_hash"); luaopen_lcm__hash(L); lua_rawset(L, -3); lua_pushstring(L, "_pack"); luaopen_lcm__pack(L); lua_rawset(L, -3); return 1; }
#ifdef __cplusplus extern "C" { #endif #include "lua.h" #ifdef __cplusplus } #endif #include "lualcm_lcm.h" #include "lualcm_hash.h" #include "lualcm_pack.h" int luaopen_lcm_lcm(lua_State* L) { ll_lcm_makemetatable(L); ll_lcm_register_new(L); return 1; } int luaopen_lcm__hash(lua_State* L) { ll_hash_makemetatable(L); ll_hash_register_new(L); return 1; } int luaopen_lcm__pack(lua_State* L) { ll_pack_register(L); return 1; } #if defined(_WIN32) __declspec(dllexport) #elif __GNUC__ >= 4 || defined(__clang__) __attribute__((visibility ("default"))) #endif int luaopen_lcm(lua_State* L) { lua_newtable(L); lua_pushstring(L, "lcm"); luaopen_lcm_lcm(L); lua_rawset(L, -3); lua_pushstring(L, "_hash"); luaopen_lcm__hash(L); lua_rawset(L, -3); lua_pushstring(L, "_pack"); luaopen_lcm__pack(L); lua_rawset(L, -3); return 1; }
Correct bug : result is float, not integer
#ifndef TESTDATA_H #define TESTDATA_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include "Node.h" #include <vector> namespace GEP { //////////////////////////////////////////////////////////// /// \brief TestData is data to test expression and calculate fitness. /// //////////////////////////////////////////////////////////// struct TestData { std::vector<float> variable; int result; }; float CalculFitnessFrom(TestData & testData,PtrNode root); } // namespace GEP #endif // TESTDATA_H
#ifndef TESTDATA_H #define TESTDATA_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include "Node.h" #include <vector> namespace GEP { //////////////////////////////////////////////////////////// /// \brief TestData is data to test expression and calculate fitness. /// //////////////////////////////////////////////////////////// struct TestData { std::vector<float> variable; float result; }; float CalculFitnessFrom(TestData & testData,PtrNode root); } // namespace GEP #endif // TESTDATA_H
Add CPU Hot Plug Data include file
/** @file Definition for a structure sharing information for CPU hot plug. Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _CPU_HOT_PLUG_DATA_H_ #define _CPU_HOT_PLUG_DATA_H_ #define CPU_HOT_PLUG_DATA_REVISION_1 0x00000001 typedef struct { UINT32 Revision; // Used for version identification for this structure UINT32 ArrayLength; // The entries number of the following ApicId array and SmBase array // // Data required for SMBASE relocation // UINT64 *ApicId; // Pointer to ApicId array UINTN *SmBase; // Pointer to SmBase array UINT32 Reserved; UINT32 SmrrBase; UINT32 SmrrSize; } CPU_HOT_PLUG_DATA; #endif
Add basic test for macro argument stringizer
/* name: TEST027 description: Test of cpp stringizer output: F2 G3 F2 main { \ A5 P p A5 "68656C6C6F20697320626574746572207468616E20627965 'P :P r A5 @K gK } */ #define x(y) #y int main(void) { char *p; p = x(hello) " is better than bye"; return *p; }
Add Loader and AVFoundation playback to clappr base header.
#ifndef Pods_Clappr_h #define Pods_Clappr_h #import <Foundation/Foundation.h> #import <Clappr/Player.h> #import <Clappr/CLPBaseObject.h> #import <Clappr/CLPUIObject.h> #import <Clappr/CLPContainer.h> #import <Clappr/CLPPlayback.h> #import <Clappr/CLPMediaControl.h> #import <Clappr/CLPCore.h> #import <Clappr/CLPPlayer.h> #import <Clappr/CLPScrubberView.h> #endif
#ifndef Pods_Clappr_h #define Pods_Clappr_h // System #import <Foundation/Foundation.h> //TODO To be excluded #import <Clappr/Player.h> // Core #import <Clappr/CLPBaseObject.h> #import <Clappr/CLPUIObject.h> #import <Clappr/CLPContainer.h> #import <Clappr/CLPPlayback.h> #import <Clappr/CLPMediaControl.h> #import <Clappr/CLPCore.h> #import <Clappr/CLPPlayer.h> // Components #import <Clappr/CLPLoader.h> // Plugins #import <Clappr/CLPAVFoundationPlayback.h> // Views #import <Clappr/CLPScrubberView.h> #endif
Purge tabs and fix a comment.
/* * A solution to Exercise 2-3 in The C Programming Language (Second Edition). * * This file was written by Damien Dart, <damiendart@pobox.com>. This is free * and unencumbered software released into the public domain. For more * information, please refer to the accompanying "UNLICENCE" file. */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> int16_t lower(int16_t); int main(void) { int16_t character; while((character = getchar()) != EOF) { putchar(lower(character)); } return EXIT_SUCCESS; } int16_t lower(int16_t character) { return (character >= 'A' && character <= 'Z') ? character + 'a' - 'A' : character; }
/* * A solution to Exercise 2-10 in The C Programming Language (Second Edition). * * This file was written by Damien Dart, <damiendart@pobox.com>. This is free * and unencumbered software released into the public domain. For more * information, please refer to the accompanying "UNLICENCE" file. */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> int16_t lower(int16_t); int main(void) { int16_t character; while((character = getchar()) != EOF) { putchar(lower(character)); } return EXIT_SUCCESS; } int16_t lower(int16_t character) { return (character >= 'A' && character <= 'Z') ? character + 'a' - 'A' : character; }
Add a helper macro for simple async render thread invokes
#ifndef RENDERMANAGER_H #define RENDERMANAGER_H #include <QMutex> #include <QQueue> #include <QString> #include <QThread> #include <QWaitCondition> #include <functional> #include "renderdoc_replay.h" struct IReplayRenderer; class LambdaThread; class RenderManager { public: typedef std::function<void(IReplayRenderer *)> InvokeMethod; RenderManager(); ~RenderManager(); void Init(int proxyRenderer, QString replayHost, QString logfile, float *progress); bool IsRunning(); ReplayCreateStatus GetCreateStatus() { return m_CreateStatus; } void AsyncInvoke(InvokeMethod m); void BlockInvoke(InvokeMethod m); void CloseThread(); private: struct InvokeHandle { InvokeHandle(InvokeMethod m) { method = m; processed = false; selfdelete = true; } InvokeMethod method; bool processed; bool selfdelete; }; void run(); QMutex m_RenderLock; QQueue<InvokeHandle *> m_RenderQueue; QWaitCondition m_RenderCondition; void PushInvoke(InvokeHandle *cmd); int m_ProxyRenderer; QString m_ReplayHost; QString m_Logfile; float *m_Progress; volatile bool m_Running; LambdaThread *m_Thread; ReplayCreateStatus m_CreateStatus; }; #endif // RENDERMANAGER_H
#ifndef RENDERMANAGER_H #define RENDERMANAGER_H #include <QMutex> #include <QQueue> #include <QString> #include <QThread> #include <QWaitCondition> #include <functional> #include "renderdoc_replay.h" struct IReplayRenderer; class LambdaThread; // simple helper for the common case of 'we just need to run this on the render thread #define INVOKE_MEMFN(function) \ m_Core->Renderer()->AsyncInvoke([this](IReplayRenderer *) { function(); }); class RenderManager { public: typedef std::function<void(IReplayRenderer *)> InvokeMethod; RenderManager(); ~RenderManager(); void Init(int proxyRenderer, QString replayHost, QString logfile, float *progress); bool IsRunning(); ReplayCreateStatus GetCreateStatus() { return m_CreateStatus; } void AsyncInvoke(InvokeMethod m); void BlockInvoke(InvokeMethod m); void CloseThread(); private: struct InvokeHandle { InvokeHandle(InvokeMethod m) { method = m; processed = false; selfdelete = true; } InvokeMethod method; bool processed; bool selfdelete; }; void run(); QMutex m_RenderLock; QQueue<InvokeHandle *> m_RenderQueue; QWaitCondition m_RenderCondition; void PushInvoke(InvokeHandle *cmd); int m_ProxyRenderer; QString m_ReplayHost; QString m_Logfile; float *m_Progress; volatile bool m_Running; LambdaThread *m_Thread; ReplayCreateStatus m_CreateStatus; }; #endif // RENDERMANAGER_H
Correct nonblocking receive of a value larger than 8 bytes.
/* go-rec-nb-big.c -- nonblocking receive of something big on a channel. Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ #include <stdint.h> #include <assert.h> #include "channel.h" _Bool __go_receive_nonblocking_big (struct __go_channel* channel, void *val) { size_t alloc_size; size_t offset; alloc_size = ((channel->element_size + sizeof (uint64_t) - 1) / sizeof (uint64_t)); int data = __go_receive_nonblocking_acquire (channel); if (data != RECEIVE_NONBLOCKING_ACQUIRE_DATA) { __builtin_memset (val, 0, channel->element_size); if (data == RECEIVE_NONBLOCKING_ACQUIRE_NODATA) return 0; else { /* Channel is closed. */ return 1; } } offset = channel->next_store * alloc_size; __builtin_memcpy (val, &channel->data[offset], channel->element_size); __go_receive_release (channel); return 1; }
/* go-rec-nb-big.c -- nonblocking receive of something big on a channel. Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ #include <stdint.h> #include <assert.h> #include "channel.h" _Bool __go_receive_nonblocking_big (struct __go_channel* channel, void *val) { size_t alloc_size; size_t offset; alloc_size = ((channel->element_size + sizeof (uint64_t) - 1) / sizeof (uint64_t)); int data = __go_receive_nonblocking_acquire (channel); if (data != RECEIVE_NONBLOCKING_ACQUIRE_DATA) { __builtin_memset (val, 0, channel->element_size); if (data == RECEIVE_NONBLOCKING_ACQUIRE_NODATA) return 0; else { /* Channel is closed. */ return 1; } } offset = channel->next_fetch * alloc_size; __builtin_memcpy (val, &channel->data[offset], channel->element_size); __go_receive_release (channel); return 1; }
Fix issues with circular buffer
template<class T, size_t S> class CircularBuffer { public: CircularBuffer() : index(0), count(0) {} void push_item(T item) { array[index + 1] = item; index = (index + 1) % S; count++; } T pop_item() { if (count > 0) { int old_index = index; index = index == 0 ? S - 1 : index - 1; count--; return array[old_index]; } } T peak_item() { if (count > 0) { return array[index]; } } private: int index; int count; T array[S]; };
template<class T, size_t S> class CircularBuffer { public: CircularBuffer() : index(0), count(0) {} void push_item(T item) { index = (index + 1) % S; array[index] = item; if (count < S) count++; } T pop_item() { int old_index = index; if (count > 0) { index = index == 0 ? S - 1 : index - 1; count--; } return array[old_index]; } T peek_item() { return array[index]; } private: int index; int count; T array[S]; };
Implement some part of convex hull
#ifndef CONVEX_HULL_H #define CONVEX_HULL_H #endif
#ifndef CONVEX_HULL_H #define CONVEX_HULL_H #include <algorithm> #include "Structure.h" #include "Math/Vector2.h" namespace ConvexHull { inline double Cross(const Vector2& O, const Vector2& A, const Vector2& B) { return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x); } inline std::vector<Corner*> CalculateConvexHull(std::vector<Corner*> P) { int n = P.size(), k = 0; std::vector<Corner*> H(2 * n); // Sort points lexicographically sort(P.begin(), P.end(), [](Corner* c1, Corner* c2) { return c1->m_position.x < c2->m_position.x || (c1->m_position.x == c2->m_position.x && c1->m_position.y < c2->m_position.y); }); // Build lower hull for (int i = 0; i < n; ++i) { while (k >= 2 && cross(H[k - 2]->m_position, H[k - 1]->m_position, P[i]->m_position) <= 0) k--; H[k++] = P[i]; } // Build upper hull for (int i = n - 2, t = k + 1; i >= 0; i--) { while (k >= t && cross(H[k - 2]->m_position, H[k - 1]->m_position, P[i]->m_position) <= 0) k--; H[k++] = P[i]; } H.resize(k - 1); return P; } }; #endif
Add error code for failing query.
/* * Copyright (C) 2010 Igalia S.L. * * Contact: Iago Toral Quiroga <itoral@igalia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */ #ifndef _MS_ERROR_H_ #define _MS_ERROR_H_ #define MS_ERROR g_quark_from_static_string("media-store.error.general") enum { MS_ERROR_BROWSE_FAILED = 1, MS_ERROR_SEARCH_FAILED, MS_ERROR_METADATA_FAILED, MS_ERROR_MEDIA_NOT_FOUND }; #endif
/* * Copyright (C) 2010 Igalia S.L. * * Contact: Iago Toral Quiroga <itoral@igalia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */ #ifndef _MS_ERROR_H_ #define _MS_ERROR_H_ #define MS_ERROR g_quark_from_static_string("media-store.error.general") enum { MS_ERROR_BROWSE_FAILED = 1, MS_ERROR_SEARCH_FAILED, MS_ERROR_QUERY_FAILED, MS_ERROR_METADATA_FAILED, MS_ERROR_MEDIA_NOT_FOUND }; #endif
Make this test not try to write on object file and test all of the output rather than just part of it.
// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options " %clang x -O2 b -O3 2>&1 | FileCheck %s // RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-mfoo" %clang -Werror %s -c 2>&1 | FileCheck %s -check-prefix=RM-WERROR // FIXME: It seems doesn't work with gcc-driver. // REQUIRES: clang-driver // CHECK-NOT: ### // CHECK: Option 0 - Name: "-ccc-print-options", Values: {} // CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"} // CHECK-NEXT: Option 2 - Name: "-O", Values: {"ignore"} // CHECK-NEXT: Option 3 - Name: "-O", Values: {"magic"} // RM-WERROR: ### QA_OVERRIDE_GCC3_OPTIONS: x-Werror +-mfoo // RM-WERROR-NEXT: ### Deleting argument -Werror // RM-WERROR-NEXT: ### Adding argument -mfoo at end // RM-WERROR-NEXT: warning: argument unused during compilation: '-mfoo'
// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options " %clang x -O2 b -O3 2>&1 | FileCheck %s // RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-mfoo" %clang -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR // CHECK-NOT: ### // CHECK: Option 0 - Name: "-ccc-print-options", Values: {} // CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"} // CHECK-NEXT: Option 2 - Name: "-O", Values: {"ignore"} // CHECK-NEXT: Option 3 - Name: "-O", Values: {"magic"} // RM-WERROR: ### QA_OVERRIDE_GCC3_OPTIONS: x-Werror +-mfoo // RM-WERROR-NEXT: ### Deleting argument -Werror // RM-WERROR-NEXT: ### Adding argument -mfoo at end // RM-WERROR: warning: argument unused during compilation: '-mfoo' // RM-WERROR-NOT: "-Werror"
Make this an empty file just with a comment in it.
#ifndef GNOME_PROPERTIES_H #define GNOME_PROPERTIES_H #include <libgnome/gnome-defs.h> BEGIN_GNOME_DECLS END_GNOME_DECLS #endif
/* This file is currently empty; I'm going to add new code here soon. Oct 27 1998. Martin */
Remove llabs declaration from openlibm port
#ifndef _OPENLIB_FINITE_H #define _OPENLIB_FINITE_H #include <sys/cdefs.h> #define __BSD_VISIBLE 1 #include <../../build/extbld/third_party/lib/OpenLibm/install/openlibm_math.h> static inline int finite(double x) { return isfinite(x); } static inline int finitef(float x) { return isfinite(x); } static inline int finitel(long double x) { return isfinite(x); } #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) __BEGIN_DECLS extern long long int llabs(long long int j); __END_DECLS #endif #endif /* _OPENLIB_FINITE_H */
#ifndef _OPENLIB_FINITE_H #define _OPENLIB_FINITE_H #include <sys/cdefs.h> #define __BSD_VISIBLE 1 #include <../../build/extbld/third_party/lib/OpenLibm/install/openlibm_math.h> static inline int finite(double x) { return isfinite(x); } static inline int finitef(float x) { return isfinite(x); } static inline int finitel(long double x) { return isfinite(x); } #endif /* _OPENLIB_FINITE_H */
Remove 'auto' from parameter list
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you 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 IMPALA_UTIL_SCOPE_EXIT_TRIGGER_H #define IMPALA_UTIL_SCOPE_EXIT_TRIGGER_H #include <functional> namespace impala { /// Utility class that calls a client-supplied function when it is destroyed. /// /// Use judiciously - scope exits can be hard to reason about, and this class should not /// act as proxy for work-performing d'tors, which we try to avoid. class ScopeExitTrigger { public: ScopeExitTrigger(const auto& trigger) : trigger_(trigger) {} ~ScopeExitTrigger() { trigger_(); } private: std::function<void()> trigger_; }; } #endif
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you 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 IMPALA_UTIL_SCOPE_EXIT_TRIGGER_H #define IMPALA_UTIL_SCOPE_EXIT_TRIGGER_H #include <functional> namespace impala { /// Utility class that calls a client-supplied function when it is destroyed. /// /// Use judiciously - scope exits can be hard to reason about, and this class should not /// act as proxy for work-performing d'tors, which we try to avoid. class ScopeExitTrigger { public: ScopeExitTrigger(const std::function<void()>& trigger) : trigger_(trigger) {} ~ScopeExitTrigger() { trigger_(); } private: std::function<void()> trigger_; }; } #endif
Solve TDA Rational in c
#include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main() { int16_t n, a, b, c, d, r, num, den, num_r, den_r, j; char o, i; scanf("%d", &n); while (n--) { scanf("%d %c %d %c %d %c %d", &a, &i, &b, &o, &c, &i, &d); switch (o) { case '+': num = (b * d) * a / b + (b * d) * c / d; den = b * d; break; case '-': num = (b * d) * a / b - (b * d) * c / d; den = b * d; break; case '*': num = a * c; den = b * d; break; default: num = a * d; den = b * c; break; } if (abs(num) < abs(den)) { r = abs(num); } else { r = abs(den); } num_r = num; den_r = den; j = 2; while (j <= r / 2 + 1) { if (num_r % j == 0 && den_r % j == 0) { num_r = num_r / j; den_r = den_r / j; } else { j++; } } printf("%d/%d = %d/%d\n", num, den, num_r, den_r); } return 0; }
Add Dodge skill as temporary hack
#ifndef SKILLCOMPONENT_H_ #define SKILLCOMPONENT_H_ #include "entity/components/AttributeComponent.h" /** * Data structure to represent an Entity's skill. */ typedef struct { int ranks; ///< Current ranks in the skill int xp; ///< Amount of XP earned towards next rank } SkillComponent; /** * Enumeration for identifying different skills. */ enum skill_t { Melee, Swords, BastardSword, Maces, SpikedMace, FirstAid }; /** * This array defines our parent skill relationships. * * If a skill's parent is itself, it has no parent. */ const skill_t PARENT_SKILLS[] = { Melee, Melee, Swords, Melee, Maces, FirstAid }; /** * This array defines our skill-attribute relationships. */ const attrtype_t SKILL_ATTRIBUTES[] = { Str, Str, Str, Str, Str, Int }; #endif
#ifndef SKILLCOMPONENT_H_ #define SKILLCOMPONENT_H_ #include "entity/components/AttributeComponent.h" /** * Data structure to represent an Entity's skill. */ typedef struct { int ranks; ///< Current ranks in the skill int xp; ///< Amount of XP earned towards next rank } SkillComponent; /** * Enumeration for identifying different skills. * @todo: Dodge is actually a "meta" skill, one calculated from other attributes */ enum skill_t { Melee, Swords, BastardSword, Maces, SpikedMace, FirstAid, Dodge }; /** * This array defines our parent skill relationships. * * If a skill's parent is itself, it has no parent. */ const skill_t PARENT_SKILLS[] = { Melee, Melee, Swords, Melee, Maces, FirstAid, Dodge }; /** * This array defines our skill-attribute relationships. */ const attrtype_t SKILL_ATTRIBUTES[] = { Str, Str, Str, Str, Str, Int, Dex }; #endif
Switch Skia to the new sweep gradient impl
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h" #define GR_TEST_UTILS 1 #define SKIA_DLL #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024) #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024) #define SK_USE_FREETYPE_EMBOLDEN // Legacy flags #define SK_IGNORE_GPU_DITHER #define SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS #define SK_LEGACY_SWEEP_GRADIENT #define SK_SUPPORT_DEPRECATED_CLIPOPS #define SK_SUPPORT_LEGACY_BILERP_IGNORING_HACK // Needed until we fix https://bug.skia.org/2440 #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG #define SK_SUPPORT_LEGACY_DRAWFILTER #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER #define SK_SUPPORT_LEGACY_GRADIENT_DITHERING #define SK_SUPPORT_LEGACY_SHADER_ISABITMAP #define SK_SUPPORT_LEGACY_TILED_BITMAPS #endif // SkUserConfigManual_DEFINED
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h" #define GR_TEST_UTILS 1 #define SKIA_DLL #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024) #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024) #define SK_USE_FREETYPE_EMBOLDEN // Legacy flags #define SK_IGNORE_GPU_DITHER #define SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS #define SK_SUPPORT_DEPRECATED_CLIPOPS #define SK_SUPPORT_LEGACY_BILERP_IGNORING_HACK // Needed until we fix https://bug.skia.org/2440 #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG #define SK_SUPPORT_LEGACY_DRAWFILTER #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER #define SK_SUPPORT_LEGACY_GRADIENT_DITHERING #define SK_SUPPORT_LEGACY_SHADER_ISABITMAP #define SK_SUPPORT_LEGACY_TILED_BITMAPS #endif // SkUserConfigManual_DEFINED
Fix braindead pasto, caught by Matt Beaumont-Gay.
/* ===-- limits.h - stub SDK header for compiler-rt -------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * * ===-----------------------------------------------------------------------=== * * This is a stub SDK header file. This file is not part of the interface of * this library nor an official version of the appropriate SDK header. It is * intended only to stub the features of this header required by compiler-rt. * * ===-----------------------------------------------------------------------=== */ #ifndef __SYS_MMAN_H__ #define __SYS_MMAN_H__ typedef __SIZE_TYPE__ size_t; #define PROT_READ 0x1 #define PROT_WRITE 0x1 #define PROT_EXEC 0x4 extern int mprotect (void *__addr, size_t __len, int __prot) __attribute__((__nothrow__)); #endif /* __SYS_MMAN_H__ */
/* ===-- limits.h - stub SDK header for compiler-rt -------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * * ===-----------------------------------------------------------------------=== * * This is a stub SDK header file. This file is not part of the interface of * this library nor an official version of the appropriate SDK header. It is * intended only to stub the features of this header required by compiler-rt. * * ===-----------------------------------------------------------------------=== */ #ifndef __SYS_MMAN_H__ #define __SYS_MMAN_H__ typedef __SIZE_TYPE__ size_t; #define PROT_READ 0x1 #define PROT_WRITE 0x2 #define PROT_EXEC 0x4 extern int mprotect (void *__addr, size_t __len, int __prot) __attribute__((__nothrow__)); #endif /* __SYS_MMAN_H__ */
Update version number to 1.55
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. constexpr float kCurrentVersion = 1.54f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. constexpr float kCurrentVersion = 1.55f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
Fix bug in shape yaml emit
#pragma once #include "geometry.h" #include "yaml_utils.h" #include <vector> #include <boost/shared_ptr.hpp> #include <librevenge/librevenge.h> namespace libpagemaker { class PMDPage { std::vector<boost::shared_ptr<PMDLineSet> > m_shapes; public: PMDPage() : m_shapes() { } void addShape(boost::shared_ptr<PMDLineSet> shape) { m_shapes.push_back(shape); } unsigned numShapes() const { return m_shapes.size(); } boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const { return m_shapes.at(i); } void emitYaml(yaml_emitter_t *emitter) const { yamlIndirectForeach(emitter, "shapes", m_shapes); } }; } /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
#pragma once #include "geometry.h" #include "yaml_utils.h" #include <vector> #include <boost/shared_ptr.hpp> #include <librevenge/librevenge.h> namespace libpagemaker { class PMDPage { std::vector<boost::shared_ptr<PMDLineSet> > m_shapes; public: PMDPage() : m_shapes() { } void addShape(boost::shared_ptr<PMDLineSet> shape) { m_shapes.push_back(shape); } unsigned numShapes() const { return m_shapes.size(); } boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const { return m_shapes.at(i); } void emitYaml(yaml_emitter_t *emitter) const { yamlBeginMap(emitter); yamlIndirectForeach(emitter, "shapes", m_shapes); yamlEndMap(emitter); } }; } /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Revert some $OpenBSD$ additions about which there are doubts.
/* $OpenBSD: zopenbsd.c,v 1.4 2015/01/20 04:41:01 krw Exp $ */ #include <sys/types.h> #include <sys/malloc.h> #include <lib/libz/zutil.h> /* * Space allocation and freeing routines for use by zlib routines. */ void * zcalloc(notused, items, size) void *notused; u_int items, size; { return mallocarray(items, size, M_DEVBUF, M_NOWAIT); } void zcfree(notused, ptr) void *notused; void *ptr; { free(ptr, M_DEVBUF, 0); }
#include <sys/types.h> #include <sys/malloc.h> #include <lib/libz/zutil.h> /* * Space allocation and freeing routines for use by zlib routines. */ void * zcalloc(notused, items, size) void *notused; u_int items, size; { return mallocarray(items, size, M_DEVBUF, M_NOWAIT); } void zcfree(notused, ptr) void *notused; void *ptr; { free(ptr, M_DEVBUF, 0); }
Use const reference for exception
//! \file WalkerException.h #ifndef WALKEREXCEPTION_H #define WALKEREXCEPTION_H #include <stdexcept> #include <string> namespace WikiWalker { //! (base) class for exceptions in WikiWalker class WalkerException : public std::runtime_error { public: /*! Create a Walker exception with a message. * * Message might be shown on exception occurring, depending on * the compiler. * * \param exmessage The exception message. */ explicit WalkerException(std::string exmessage) : runtime_error(exmessage) { } }; } // namespace WikiWalker #endif // WALKEREXCEPTION_H
//! \file WalkerException.h #ifndef WALKEREXCEPTION_H #define WALKEREXCEPTION_H #include <stdexcept> #include <string> namespace WikiWalker { //! (base) class for exceptions in WikiWalker class WalkerException : public std::runtime_error { public: /*! Create a Walker exception with a message. * * Message might be shown on exception occurring, depending on * the compiler. * * \param exmessage The exception message. */ explicit WalkerException(const std::string& exmessage) : runtime_error(exmessage) { } }; } // namespace WikiWalker #endif // WALKEREXCEPTION_H
Fix forward declaration of HnswGraph.
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <cstdint> namespace search::fileutil { class LoadedBuffer; } namespace search::tensor { class HnswGraph; /** * Implements loading of HNSW graph structure from binary format. **/ class HnswIndexLoader { public: HnswIndexLoader(HnswGraph &graph); ~HnswIndexLoader(); bool load(const fileutil::LoadedBuffer& buf); private: HnswGraph &_graph; const uint32_t *_ptr; const uint32_t *_end; bool _failed; uint32_t next_int() { if (__builtin_expect((_ptr == _end), false)) { _failed = true; return 0; } return *_ptr++; } }; }
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <cstdint> namespace search::fileutil { class LoadedBuffer; } namespace search::tensor { struct HnswGraph; /** * Implements loading of HNSW graph structure from binary format. **/ class HnswIndexLoader { public: HnswIndexLoader(HnswGraph &graph); ~HnswIndexLoader(); bool load(const fileutil::LoadedBuffer& buf); private: HnswGraph &_graph; const uint32_t *_ptr; const uint32_t *_end; bool _failed; uint32_t next_int() { if (__builtin_expect((_ptr == _end), false)) { _failed = true; return 0; } return *_ptr++; } }; }
Make include file consistent with the rest of libstand.
/*- * Copyright (c) 1998 Michael Smith. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #include <stand.h> #include <assert.h> void __assert(const char *file, int line, const char *expression) { printf("assertion \"%s\" failed: file \"%s\", line %d\n", expression, file, line); exit(); }
/*- * Copyright (c) 1998 Michael Smith. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #include <assert.h> #include "stand.h" void __assert(const char *file, int line, const char *expression) { printf("assertion \"%s\" failed: file \"%s\", line %d\n", expression, file, line); exit(); }
Fix import so it doesn't corrupt debug console
#ifdef AMPLITUDE_SSL_PINNING // // Amplitude+SSLPinning // Amplitude // // Created by Allan on 3/11/15. // Copyright (c) 2015 Amplitude. All rights reserved. // #import <Foundation/Foundation.h> @interface Amplitude (SSLPinning) @property (nonatomic, assign) BOOL sslPinningEnabled; @end #endif
// // Amplitude+SSLPinning // Amplitude // // Created by Allan on 3/11/15. // Copyright (c) 2015 Amplitude. All rights reserved. // @import Foundation; #import "Amplitude.h" @interface Amplitude (SSLPinning) #ifdef AMPLITUDE_SSL_PINNING @property (nonatomic, assign) BOOL sslPinningEnabled; #endif @end
Work from MacBook & PC
#include <stdio.h> #include <stdlib.h> #include <time.h> #define _Q(x) #x #define Q(x) _Q(x) #define print_calc(_a, _b, _op) printf("%2d "Q(_op)" %2d = %d\n", _a, _b, _a _op _b) #define rand_num(x) rand() % x + 1 #define print_block(OP) \ _a1 = rand_num(20); \ _b1 = rand_num(20); \ print_calc(_a1, _b1, OP); \ _a1 = rand_num(20); \ _b1 = rand_num(20); \ print_calc(_a1, _b1, OP); \ _a1 = rand_num(20); \ _b1 = rand_num(20); \ print_calc(_a1, _b1, OP); \ _a1 = rand_num(20); \ _b1 = rand_num(20); \ print_calc(_a1, _b1, OP); \ printf("\n"); int main() { srand(time(NULL)); int _a1, _b1; print_block(+); print_block(-); print_block(*); print_block(/); return 0; }
Add experimental notice to global interceptor
/* * * Copyright 2019 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #import "GRPCCall.h" @protocol GRPCInterceptorFactory; @interface GRPCCall2 (Interceptor) + (void)registerGlobalInterceptor:(id<GRPCInterceptorFactory>)interceptorFactory; + (id<GRPCInterceptorFactory>)globalInterceptorFactory; @end
/* * * Copyright 2019 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ // The global interceptor feature is experimental and might be modified or removed at any time. #import "GRPCCall.h" @protocol GRPCInterceptorFactory; @interface GRPCCall2 (Interceptor) + (void)registerGlobalInterceptor:(id<GRPCInterceptorFactory>)interceptorFactory; + (id<GRPCInterceptorFactory>)globalInterceptorFactory; @end
Use 'unsigned:1' when we mean boolean options
#ifndef FETCH_PACK_H #define FETCH_PACK_H struct fetch_pack_args { const char *uploadpack; int quiet; int keep_pack; int unpacklimit; int use_thin_pack; int fetch_all; int verbose; int depth; int no_progress; }; void setup_fetch_pack(struct fetch_pack_args *args); struct ref *fetch_pack(const char *dest, int nr_heads, char **heads, char **pack_lockfile); #endif
#ifndef FETCH_PACK_H #define FETCH_PACK_H struct fetch_pack_args { const char *uploadpack; int unpacklimit; int depth; unsigned quiet:1, keep_pack:1, use_thin_pack:1, fetch_all:1, verbose:1, no_progress:1; }; void setup_fetch_pack(struct fetch_pack_args *args); struct ref *fetch_pack(const char *dest, int nr_heads, char **heads, char **pack_lockfile); #endif
Add name method to custom tools
#ifndef QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #define QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #include "abstractformeditortool.h" namespace QmlDesigner { class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool { public: AbstractCustomTool(); void selectedItemsChanged(const QList<FormEditorItem *> &itemList) QTC_OVERRIDE; virtual int wantHandleItem(const ModelNode &modelNode) const QTC_OVERRIDE = 0; }; } // namespace QmlDesigner #endif // QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H
#ifndef QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #define QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #include "abstractformeditortool.h" namespace QmlDesigner { class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool { public: AbstractCustomTool(); void selectedItemsChanged(const QList<FormEditorItem *> &itemList) QTC_OVERRIDE; virtual QString name() const = 0; virtual int wantHandleItem(const ModelNode &modelNode) const QTC_OVERRIDE = 0; }; } // namespace QmlDesigner #endif // QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H
Add mushcursor.box_idx, for Funge-98 only
// File created: 2011-09-02 23:36:23 #ifndef MUSHSPACE_CURSOR_H #define MUSHSPACE_CURSOR_H #include "space.all.h" #define mushcursor MUSHSPACE_NAME(mushcursor) // What kind of an area is the cursor in? typedef enum MushCursorMode { MushCursorMode_static, MushCursorMode_dynamic, MushCursorMode_bak, } MushCursorMode; #if MUSHSPACE_93 #define MUSHCURSOR_MODE(x) MushCursorMode_static #else #define MUSHCURSOR_MODE(x) ((x)->mode) #endif typedef struct mushcursor { #if !MUSHSPACE_93 MushCursorMode mode; #endif mushspace *space; mushcoords pos; } mushcursor; #define mushcursor_sizeof MUSHSPACE_CAT(mushcursor,_sizeof) #define mushcursor_init MUSHSPACE_CAT(mushcursor,_init) extern const size_t mushcursor_sizeof; mushcursor* mushcursor_init(mushspace*, mushcoords, mushcoords, void*); #endif
// File created: 2011-09-02 23:36:23 #ifndef MUSHSPACE_CURSOR_H #define MUSHSPACE_CURSOR_H #include "space.all.h" #define mushcursor MUSHSPACE_NAME(mushcursor) // What kind of an area is the cursor in? typedef enum MushCursorMode { MushCursorMode_static, MushCursorMode_dynamic, MushCursorMode_bak, } MushCursorMode; #if MUSHSPACE_93 #define MUSHCURSOR_MODE(x) MushCursorMode_static #else #define MUSHCURSOR_MODE(x) ((x)->mode) #endif typedef struct mushcursor { #if !MUSHSPACE_93 MushCursorMode mode; #endif mushspace *space; mushcoords pos; #if !MUSHSPACE_93 size_t box_idx; #endif } mushcursor; #define mushcursor_sizeof MUSHSPACE_CAT(mushcursor,_sizeof) #define mushcursor_init MUSHSPACE_CAT(mushcursor,_init) extern const size_t mushcursor_sizeof; mushcursor* mushcursor_init(mushspace*, mushcoords, mushcoords, void*); #endif
Change language to improve quality and update to new vocabulary.
testScreens: testReport: DeleteInspectionLocation If [ tagTestSubjectLocation::_LtestSubjectLocation = "" ] Halt Script End If If [ tagTestSubjectLocation::inUse = "t" ] Show Custom Dialog [ Title: "!"; Message: "Deleting this set of test items is allowed after you delete all discoveries made during testing."; Buttons: “OK” ] Exit Script [ ] End If Set Variable [ $delete; Value:tagTestSubjectLocation::_LtestSubjectLocation ] Set Variable [ $location; Value:tagTestSubjectLocation::kfocus ] Go to Field [ ] Refresh Window Show Custom Dialog [ Title: "!"; Message: "Delete " & tagTestSubject::tag & "'s " & "test number " & tagTestSubjectLocation::reportNumber & " of " & tagTestSubjectLocation::focusName & "?"; Buttons: “Cancel”, “Delete” ] If [ Get ( LastMessageChoice ) = 2 ] Delete Record/Request [ No dialog ] End If Go to Layout [ original layout ] Set Variable [ $delete ] Refresh Window January 7, 平成26 14:16:54 Imagination Quality Management.fp7 - DeleteInspectionLocation -1-
testScreens: testReport: deleteInspectionLocation If [ tagTestSubjectLocation::_LtestSubjectLocation = "" ] Halt Script End If If [ tagTestSubjectLocation::inUse = "t" ] Show Custom Dialog [ Message: "Delete all test results made in this test section before deleting it. To do this, click its green test button. Click on each test item. Delete the results you find."; Buttons: “OK” ] Exit Script [ ] End If Set Variable [ $delete; Value:tagTestSubjectLocation::_LtestSubjectLocation ] Set Variable [ $location; Value:tagTestSubjectLocation::kfocus ] Go to Field [ ] Refresh Window Show Custom Dialog [ Message: "Delete test section " & tagTestSubjectLocation::focusName & " for " & tagTestSubject::tag & "'s test #" & tagTestSubjectLocation::reportNumber & "?"; Buttons: “Cancel”, “Delete” ] If [ Get ( LastMessageChoice ) = 2 ] Delete Record/Request [ No dialog ] End If Go to Layout [ original layout ] Set Variable [ $delete ] Refresh Window July 11, 平成27 11:08:18 Library.fp7 - deleteInspectionLocation -1-
Maintain the template string as an instance variable
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once #include <Windows.h> #include <unordered_map> class Control; class Dialog { public: Dialog(); Dialog(HWND parent, LPCWSTR dlgTemplate); void AddControl(Control *control); HWND DialogHandle(); HWND ParentHandle(); void Show(); protected: HWND _dlgHwnd; HWND _parent; /// <summary>Maps control IDs to their respective instances.</summary> std::unordered_map<int, Control *> _controlMap; static INT_PTR CALLBACK StaticDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); };
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once #include <Windows.h> #include <unordered_map> class Control; class Dialog { public: Dialog(); Dialog(HWND parent, LPCWSTR dlgTemplate); void AddControl(Control *control); HWND DialogHandle(); HWND ParentHandle(); void Show(); protected: HWND _dlgHwnd; HWND _parent; LPCWSTR _template; /// <summary>Maps control IDs to their respective instances.</summary> std::unordered_map<int, Control *> _controlMap; static INT_PTR CALLBACK StaticDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); };
Remove prototypes for no longer existing functions
/* * $Id$ */ #include "common.h" #include "miniobj.h" extern struct evbase *mgt_evb; /* mgt_child.c */ void mgt_run(int dflag); void mgt_start_child(void); void mgt_stop_child(void); extern pid_t mgt_pid, child_pid; /* mgt_cli.c */ void mgt_cli_init(void); void mgt_cli_setup(int fdi, int fdo, int verbose); int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); /* mgt_vcc.c */ void mgt_vcc_init(void); int mgt_vcc_default(const char *bflag, const char *fflag); int mgt_push_vcls_and_start(int *status, char **p); /* tcp.c */ int open_tcp(const char *port); #include "stevedore.h" extern struct stevedore sma_stevedore; extern struct stevedore smf_stevedore; #include "hash_slinger.h" extern struct hash_slinger hsl_slinger; extern struct hash_slinger hcl_slinger;
/* * $Id$ */ #include "common.h" #include "miniobj.h" extern struct evbase *mgt_evb; /* mgt_child.c */ void mgt_run(int dflag); extern pid_t mgt_pid, child_pid; /* mgt_cli.c */ void mgt_cli_init(void); void mgt_cli_setup(int fdi, int fdo, int verbose); int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); /* mgt_vcc.c */ void mgt_vcc_init(void); int mgt_vcc_default(const char *bflag, const char *fflag); int mgt_push_vcls_and_start(int *status, char **p); /* tcp.c */ int open_tcp(const char *port); #include "stevedore.h" extern struct stevedore sma_stevedore; extern struct stevedore smf_stevedore; #include "hash_slinger.h" extern struct hash_slinger hsl_slinger; extern struct hash_slinger hcl_slinger;
Add relational traces example where 1-clusters are needed
// SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag extern int __VERIFIER_nondet_int(); #include <pthread.h> #include <assert.h> int g = 0; int h = 0; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { pthread_mutex_lock(&A); g = 16; pthread_mutex_unlock(&A); return NULL; } void *t_fun2(void *arg) { pthread_mutex_lock(&A); h = __VERIFIER_nondet_int(); h = 12; pthread_mutex_unlock(&A); return NULL; } int main(void) { pthread_t id, id2; pthread_create(&id, NULL, t_fun, NULL); pthread_create(&id2, NULL, t_fun2, NULL); pthread_mutex_lock(&A); h = 31; pthread_mutex_unlock(&A); pthread_mutex_lock(&A); h = 12; pthread_mutex_unlock(&A); pthread_mutex_lock(&A); int z = h; assert(z != 31); pthread_mutex_unlock(&A); return 0; }
Move the arrays out of the stack into global mem
#include "stdio.h" #include "stdlib.h" #define TRIALS 4 #define MATRIX_SIZE 1024 int main(int argc, char* argv[]) { short A[MATRIX_SIZE][MATRIX_SIZE], B[MATRIX_SIZE][MATRIX_SIZE], C[MATRIX_SIZE][MATRIX_SIZE]; // Initalize array A and B with '1's for (int i = 0; i < MATRIX_SIZE; ++i) for (int k = 0; k < MATRIX_SIZE; ++k) A[i][k] = B[i][k] = 1; // Iterate through the block sizes for (int block_size = 4; block_size <= 256; block_size *= 2) { // Run TRIALS number of trials for each block size for (int trial = 0; trial < TRIALS; ++trial) { printf("size: %d\n", block_size); } } return 0; }
#include "stdio.h" #include "stdlib.h" #define TRIALS 4 #define MATRIX_SIZE 2048 short A[MATRIX_SIZE][MATRIX_SIZE], B[MATRIX_SIZE][MATRIX_SIZE], C[MATRIX_SIZE][MATRIX_SIZE] = {{0}}; int main(int argc, char* argv[]) { // Initalize array A and B with '1's for (int i = 0; i < MATRIX_SIZE; ++i) for (int k = 0; k < MATRIX_SIZE; ++k) A[i][k] = B[i][k] = 1; // Iterate through the block sizes for (int block_size = 4; block_size <= 256; block_size *= 2) { // Run TRIALS number of trials for each block size for (int trial = 0; trial < TRIALS; ++trial) { printf("size: %d\n", block_size); } } return 0; }
Convert BUG() to use unreachable()
#ifndef _ASM_X86_BUG_H #define _ASM_X86_BUG_H #ifdef CONFIG_BUG #define HAVE_ARCH_BUG #ifdef CONFIG_DEBUG_BUGVERBOSE #ifdef CONFIG_X86_32 # define __BUG_C0 "2:\t.long 1b, %c0\n" #else # define __BUG_C0 "2:\t.long 1b - 2b, %c0 - 2b\n" #endif #define BUG() \ do { \ asm volatile("1:\tud2\n" \ ".pushsection __bug_table,\"a\"\n" \ __BUG_C0 \ "\t.word %c1, 0\n" \ "\t.org 2b+%c2\n" \ ".popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (sizeof(struct bug_entry))); \ for (;;) ; \ } while (0) #else #define BUG() \ do { \ asm volatile("ud2"); \ for (;;) ; \ } while (0) #endif #endif /* !CONFIG_BUG */ #include <asm-generic/bug.h> #endif /* _ASM_X86_BUG_H */
#ifndef _ASM_X86_BUG_H #define _ASM_X86_BUG_H #ifdef CONFIG_BUG #define HAVE_ARCH_BUG #ifdef CONFIG_DEBUG_BUGVERBOSE #ifdef CONFIG_X86_32 # define __BUG_C0 "2:\t.long 1b, %c0\n" #else # define __BUG_C0 "2:\t.long 1b - 2b, %c0 - 2b\n" #endif #define BUG() \ do { \ asm volatile("1:\tud2\n" \ ".pushsection __bug_table,\"a\"\n" \ __BUG_C0 \ "\t.word %c1, 0\n" \ "\t.org 2b+%c2\n" \ ".popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (sizeof(struct bug_entry))); \ unreachable(); \ } while (0) #else #define BUG() \ do { \ asm volatile("ud2"); \ unreachable(); \ } while (0) #endif #endif /* !CONFIG_BUG */ #include <asm-generic/bug.h> #endif /* _ASM_X86_BUG_H */
Resolve naming conflict between Authenticate method name and enum name.
#ifndef USER_H #define USER_H #include <stdint.h> #include <QString> #include <QByteArray> #include <QVector> #include "../inc/pwentry.h" class User { public: enum AuthenticateFlag { Authenticate = 0x0000, Encrypt = 0x0001, Decrypt = 0x0002 }; User(); User(QString username, QString password); User(QString username, QByteArray auth_salt, QByteArray key_salt, QByteArray iv, QByteArray auth_hash, QVector<PwEntry> password_entries); QString username; QByteArray auth_salt; QByteArray key_salt; QByteArray iv; QByteArray auth_hash; QVector<PwEntry> password_entries; bool isDecrypted; int Authenticate(QString password, AuthenticateFlag auth_mode); int AddPwEntry(PwEntry password_entry); private: void EncryptAllPwEntries(QString password); void DecryptAllPwEntries(QString password); }; #endif // USER_H
#ifndef USER_H #define USER_H #include <stdint.h> #include <QString> #include <QByteArray> #include <QVector> #include "../inc/pwentry.h" class User { public: enum AuthenticateFlag { Auth = 0x0000, Encrypt = 0x0001, Decrypt = 0x0002 }; User(); User(QString username, QString password); User(QString username, QByteArray auth_salt, QByteArray key_salt, QByteArray iv, QByteArray auth_hash, QVector<PwEntry> password_entries); QString username; QByteArray auth_salt; QByteArray key_salt; QByteArray iv; QByteArray auth_hash; QVector<PwEntry> password_entries; bool isDecrypted; int Authenticate(QString password, User::AuthenticateFlag auth_mode); int AddPwEntry(PwEntry password_entry); private: void EncryptAllPwEntries(QString password); void DecryptAllPwEntries(QString password); }; #endif // USER_H
Move by machine word size
#ifndef __STDARG_H #define __STDARG_H #include "sys/types.h" typedef void *va_list; #define va_start(l, arg) l = (void *)&arg #define va_arg(l, type) (*(type *)(l += __WORDSIZE / 8)) #define va_end(l) #endif
#ifndef __STDARG_H #define __STDARG_H #include "sys/types.h" typedef void *va_list; #define va_start(l, arg) l = (void *)&arg /* * va_arg assumes arguments are promoted to * machine-word size when pushed onto the stack */ #define va_arg(l, type) (*(type *)(l += sizeof *l)) #define va_end(l) #endif
Add default values of variables
#ifndef COMPTONSPECTRUM #define COMPTONSPECTRUM #include "TH1F.h" class spectrum { public: spectrum(double initialEnergy, double resolution); void setNumberOfEvents(const int events); virtual TH1F* getHisto(); virtual void generateEvents(); protected: double fInitialEnergy; double fResolution; int fEvents; std::vector<double> fSimEvents; }; #endif //COMPTONSPECTRUM
#ifndef COMPTONSPECTRUM #define COMPTONSPECTRUM #include "TH1F.h" class spectrum { public: spectrum(double initialEnergy = 0, double resolution = 0); void setNumberOfEvents(const int events); virtual TH1F* getHisto(); virtual void generateEvents(); protected: double fInitialEnergy = 0; double fResolution = 0; int fEvents = 0; std::vector<double> fSimEvents; }; #endif //COMPTONSPECTRUM
Update gitignore and use typedef instead of struct
/* * children.h - linked list for keeping node results * * author : Jeroen van der Heijden * email : jeroen@transceptor.technology * copyright : 2016, Transceptor Technology * * changes * - initial version, 08-03-2016 * - refactoring, 17-06-2017 */ #ifndef CLERI_CHILDREN_H_ #define CLERI_CHILDREN_H_ #include <cleri/node.h> /* typedefs */ typedef struct cleri_node_s cleri_node_t; typedef struct cleri_children_s cleri_children_t; /* private functions */ cleri_children_t * cleri__children_new(void); void cleri__children_free(cleri_children_t * children); int cleri__children_add(cleri_children_t * children, cleri_node_t * node); /* structs */ struct cleri_children_s { cleri_node_t * node; struct cleri_children_s * next; }; #endif /* CLERI_CHILDREN_H_ */
/* * children.h - linked list for keeping node results * * author : Jeroen van der Heijden * email : jeroen@transceptor.technology * copyright : 2016, Transceptor Technology * * changes * - initial version, 08-03-2016 * - refactoring, 17-06-2017 */ #ifndef CLERI_CHILDREN_H_ #define CLERI_CHILDREN_H_ #include <cleri/node.h> /* typedefs */ typedef struct cleri_node_s cleri_node_t; typedef struct cleri_children_s cleri_children_t; /* private functions */ cleri_children_t * cleri__children_new(void); void cleri__children_free(cleri_children_t * children); int cleri__children_add(cleri_children_t * children, cleri_node_t * node); /* structs */ struct cleri_children_s { cleri_node_t * node; cleri_children_t * next; }; #endif /* CLERI_CHILDREN_H_ */
Add operators for ScopedHandle when it is const
// LAF OS Library // Copyright (C) 2019 Igara Studio S.A. // Copyright (C) 2012-2013 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef OS_SCOPED_HANDLE_H_INCLUDED #define OS_SCOPED_HANDLE_H_INCLUDED #pragma once namespace os { template<typename T> class ScopedHandle { public: ScopedHandle(T* handle) : m_handle(handle) { } ScopedHandle(ScopedHandle&& that) { m_handle = that.m_handle; that.m_handle = nullptr; } ~ScopedHandle() { if (m_handle) m_handle->dispose(); } T* operator->() { return m_handle; } operator T*() { return m_handle; } private: T* m_handle; // Cannot copy ScopedHandle(const ScopedHandle&); ScopedHandle& operator=(const ScopedHandle&); }; } // namespace os #endif
// LAF OS Library // Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2012-2013 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef OS_SCOPED_HANDLE_H_INCLUDED #define OS_SCOPED_HANDLE_H_INCLUDED #pragma once namespace os { template<typename T> class ScopedHandle { public: ScopedHandle(T* handle) : m_handle(handle) { } ScopedHandle(ScopedHandle&& that) { m_handle = that.m_handle; that.m_handle = nullptr; } ~ScopedHandle() { if (m_handle) m_handle->dispose(); } T* operator->() { return m_handle; } operator T*() { return m_handle; } const T* operator->() const { return m_handle; } operator const T*() const { return m_handle; } private: T* m_handle; // Cannot copy ScopedHandle(const ScopedHandle&); ScopedHandle& operator=(const ScopedHandle&); }; } // namespace os #endif
Fix import statement in library briding header
// // CardinalDebugToolkit.h // CardinalDebugToolkit // // Created by Robin Kunde on 11/3/17. // Copyright © 2017 Cardinal Solutions. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for CardinalDebugToolkit. FOUNDATION_EXPORT double CardinalDebugToolkitVersionNumber; //! Project version string for CardinalDebugToolkit. FOUNDATION_EXPORT const unsigned char CardinalDebugToolkitVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <CardinalDebugToolkit/PublicHeader.h> #import <CardinalDebugToolkit/NSUserDefaultsHelper.h>
// // CardinalDebugToolkit.h // CardinalDebugToolkit // // Created by Robin Kunde on 11/3/17. // Copyright © 2017 Cardinal Solutions. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for CardinalDebugToolkit. FOUNDATION_EXPORT double CardinalDebugToolkitVersionNumber; //! Project version string for CardinalDebugToolkit. FOUNDATION_EXPORT const unsigned char CardinalDebugToolkitVersionString[]; #import "NSUserDefaultsHelper.h"
Add x0, y0 fields in class.
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <qwt_picker.h> #include <qwt_plot_picker.h> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_enableSizeButton_clicked(); private: Ui::MainWindow *ui; double **xnPlus, **xnMinus, **ynPlus, **ynMinus; QwtPlotPicker *picker; private: void initArrays(); void initTauComboBox(); void initQwtPlot(); void initQwtPlotPicker(); double func1(double xn, double yn); double func2(double xn); void buildTrajectory(int idTraj); }; #endif // MAINWINDOW_H
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <qwt_picker.h> #include <qwt_plot_picker.h> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_enableSizeButton_clicked(); private: Ui::MainWindow *ui; double **xnPlus, **xnMinus, **ynPlus, **ynMinus; double x0, y0; QwtPlotPicker *picker; private: void initArrays(); void initTauComboBox(); void initQwtPlot(); void initQwtPlotPicker(); double func1(double xn, double yn); double func2(double xn); void buildTrajectory(int idTraj); }; #endif // MAINWINDOW_H
Update library name to new bellagio library.
/* * Copyright (C) 2007-2008 Nokia Corporation. * * Author: Felipe Contreras <felipe.contreras@nokia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef GSTOMX_H #define GSTOMX_H #include <gst/gst.h> G_BEGIN_DECLS #define DEFAULT_LIBRARY_NAME "libomxil.so.0" GST_DEBUG_CATEGORY_EXTERN (gstomx_debug); #define GST_CAT_DEFAULT gstomx_debug G_END_DECLS #endif /* GSTOMX_H */
/* * Copyright (C) 2007-2008 Nokia Corporation. * * Author: Felipe Contreras <felipe.contreras@nokia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef GSTOMX_H #define GSTOMX_H #include <gst/gst.h> G_BEGIN_DECLS #define DEFAULT_LIBRARY_NAME "libomxil-bellagio.so.0" GST_DEBUG_CATEGORY_EXTERN (gstomx_debug); #define GST_CAT_DEFAULT gstomx_debug G_END_DECLS #endif /* GSTOMX_H */
Add function side-effect test cast.
// RUN: clang -checker-simple -verify %s // RUN: clang -checker-simple -analyzer-store-region -verify %s struct s { int data; int data_array[10]; }; typedef struct { int data; } STYPE; void f(void) { int a[10]; int (*p)[10]; p = &a; (*p)[3] = 1; struct s d; struct s *q; q = &d; q->data = 3; d.data_array[9] = 17; } void f2() { char *p = "/usr/local"; char (*q)[4]; q = &"abc"; } void f3() { STYPE s; } void f4() { int a[] = { 1, 2, 3}; int b[3] = { 1, 2 }; }
// RUN: clang -checker-simple -verify %s // RUN: clang -checker-simple -analyzer-store-region -verify %s struct s { int data; int data_array[10]; }; typedef struct { int data; } STYPE; void g1(struct s* p); void f(void) { int a[10]; int (*p)[10]; p = &a; (*p)[3] = 1; struct s d; struct s *q; q = &d; q->data = 3; d.data_array[9] = 17; } void f2() { char *p = "/usr/local"; char (*q)[4]; q = &"abc"; } void f3() { STYPE s; } void f4() { int a[] = { 1, 2, 3}; int b[3] = { 1, 2 }; } void f5() { struct s data; g1(&data); }
Include stdint to get uint16_t
#include "config.h" #include <msp430.h> void delayMs(uint16_t ms); static void cpu_init(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer /* Set proper CPU clock speed */ DCOCTL = 0; #if CPU_FREQ == 1 BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; #elif CPU_FREQ == 8 BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; #elif CPU_FREQ == 12 BCSCTL1 = CALBC1_12MHZ DCOCTL = CALDCO_12HZ; #elif CPU_FREQ == 16 BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; #else #error "Unsupported CPU frequency" #endif } /* Spends 3 * n cycles */ __inline__ static void delay_cycles(register unsigned int n) { __asm__ __volatile__ ( "1: \n" " dec %[n] \n" " jne 1b \n" : [n] "+r"(n)); }
#include "config.h" #include <msp430.h> #include <stdint.h> void delayMs(uint16_t ms); static void cpu_init(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer /* Set proper CPU clock speed */ DCOCTL = 0; #if CPU_FREQ == 1 BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; #elif CPU_FREQ == 8 BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; #elif CPU_FREQ == 12 BCSCTL1 = CALBC1_12MHZ DCOCTL = CALDCO_12HZ; #elif CPU_FREQ == 16 BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; #else #error "Unsupported CPU frequency" #endif } /* Spends 3 * n cycles */ __inline__ static void delay_cycles(register unsigned int n) { __asm__ __volatile__ ( "1: \n" " dec %[n] \n" " jne 1b \n" : [n] "+r"(n)); }
Apply patch for C standards compliance: "All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined." (That's from ISO/IEC 9899:TC2 final committee draft, section 6.2.7.)
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #include "gvplugin.h" extern gvplugin_installed_t gvdevice_devil_types; static gvplugin_api_t apis[] = { {API_device, &gvdevice_devil_types}, {(api_t)0, 0}, }; gvplugin_library_t gvplugin_devil_LTX_library = { "devil", apis };
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #include "gvplugin.h" extern gvplugin_installed_t gvdevice_devil_types[]; static gvplugin_api_t apis[] = { {API_device, gvdevice_devil_types}, {(api_t)0, 0}, }; gvplugin_library_t gvplugin_devil_LTX_library = { "devil", apis };