-
Notifications
You must be signed in to change notification settings - Fork 350
debugability: macro metaprogramming refactor #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| /* | ||
| * Copyright (c) 2016, Intel Corporation | ||
| * 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 the Intel Corporation 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. | ||
| * | ||
| * Author: Michal Jerzy Wierzbicki <michalx.wierzbicki@intel.com> | ||
| */ | ||
|
|
||
| /* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY */ | ||
|
|
||
| #ifdef __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE__ | ||
| /* Macros defined in this file are only helpers for the macros that are | ||
| * defined in header file containing "namespace" | ||
| * __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE__ . | ||
| * This combination of #ifdef and #ifndef should sufficently narrow | ||
| * the "include-ability" of this dependent header file. | ||
| * If you wish to use macros from this file directly, be *V E R Y* careful! | ||
| * HIC SUNT DRACONES | ||
| */ | ||
| #ifndef __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE_DEC__ | ||
| #define __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE_DEC__ | ||
|
|
||
| /* The only sane way I found to decrement values in cpreproc */ | ||
| /* for instance META_DEC(3) will be tokenized to DEC_3 | ||
| * and then expanded again to 2 | ||
| */ | ||
| #define _META_DEC_0 0 // notice how we deal with underflow | ||
| #define _META_DEC_1 0 | ||
| #define _META_DEC_2 1 | ||
| #define _META_DEC_3 2 | ||
| #define _META_DEC_4 3 | ||
| #define _META_DEC_5 4 | ||
| #define _META_DEC_6 5 | ||
| #define _META_DEC_7 6 | ||
| #define _META_DEC_8 7 | ||
| #define _META_DEC_9 8 | ||
| #define _META_DEC_10 9 | ||
| #define _META_DEC_11 10 | ||
| #define _META_DEC_12 11 | ||
| #define _META_DEC_13 12 | ||
| #define _META_DEC_14 13 | ||
| #define _META_DEC_15 14 | ||
| #define _META_DEC_16 15 | ||
| #define _META_DEC_17 16 | ||
| #define _META_DEC_18 17 | ||
| #define _META_DEC_19 18 | ||
| #define _META_DEC_20 19 | ||
| #define _META_DEC_21 20 | ||
| #define _META_DEC_22 21 | ||
| #define _META_DEC_23 22 | ||
| #define _META_DEC_24 23 | ||
| #define _META_DEC_25 24 | ||
| #define _META_DEC_26 25 | ||
| #define _META_DEC_27 26 | ||
| #define _META_DEC_28 27 | ||
| #define _META_DEC_29 28 | ||
| #define _META_DEC_30 29 | ||
| #define _META_DEC_31 30 | ||
| #define _META_DEC_32 31 | ||
| #define _META_DEC_33 32 | ||
| #define _META_DEC_34 33 | ||
| #define _META_DEC_35 34 | ||
| #define _META_DEC_36 35 | ||
| #define _META_DEC_37 36 | ||
| #define _META_DEC_38 37 | ||
| #define _META_DEC_39 38 | ||
| #define _META_DEC_40 39 | ||
| #define _META_DEC_41 40 | ||
| #define _META_DEC_42 41 | ||
| #define _META_DEC_43 42 | ||
| #define _META_DEC_44 43 | ||
| #define _META_DEC_45 44 | ||
| #define _META_DEC_46 45 | ||
| #define _META_DEC_47 46 | ||
| #define _META_DEC_48 47 | ||
| #define _META_DEC_49 48 | ||
| #define _META_DEC_50 49 | ||
| #define _META_DEC_51 50 | ||
| #define _META_DEC_52 51 | ||
| #define _META_DEC_53 52 | ||
| #define _META_DEC_54 53 | ||
| #define _META_DEC_55 54 | ||
| #define _META_DEC_56 55 | ||
| #define _META_DEC_57 56 | ||
| #define _META_DEC_58 57 | ||
| #define _META_DEC_59 58 | ||
| #define _META_DEC_60 59 | ||
| #define _META_DEC_61 60 | ||
| #define _META_DEC_62 61 | ||
| #define _META_DEC_63 62 | ||
| #define _META_DEC_64 63 | ||
|
|
||
| #endif // __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE_DEC__ | ||
| #else | ||
| #error \ | ||
| Illegal use of header file: \ | ||
| can only be included from context of \ | ||
| __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE__ | ||
| #endif // __INCLUDE_MACRO_METAPROGRAMMING_PRIVATE__ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.