Skip to content
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

C89 API Proposal #1

Merged
merged 51 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a6a0711
Import initial work
isaachier Mar 6, 2018
fbf4867
Some fixes and implement null tracer
Mar 6, 2018
391231f
Fix anonymous union
Mar 6, 2018
b825a09
Improve test case, build static lib
Mar 6, 2018
cb8cf05
Fix GitHub token
Mar 6, 2018
e333c13
Fix invalid allocation of null span context
Mar 6, 2018
9c5a513
Fix GitHub token again
Mar 6, 2018
d504426
Move toolchain before project command
Mar 6, 2018
c21bbfe
Use timespec where available and reimplement if not
isaachier Mar 7, 2018
26a4ef7
Work on exporting symbols, remove uses of dynamic memory
isaachier Mar 7, 2018
9dce165
Change TODO to note
isaachier Mar 7, 2018
d29b9c6
Add clang-tidy support and apply fix
isaachier Mar 7, 2018
13402df
Add version header and CMake install
isaachier Mar 7, 2018
b803d53
Include config at the top of each header
isaachier Mar 7, 2018
b60b3b9
Add Doxygen link to README along with badges
Mar 7, 2018
31d7200
Begin work on dynamic loading
isaachier Mar 7, 2018
0a5bb03
Merge branch 'master' of github.com:isaachier/opentracing-c
isaachier Mar 7, 2018
5d3dfec
Add weak symbol API for tracing vendor libraries
isaachier Mar 8, 2018
04967d3
Add dynamic load test
isaachier Mar 8, 2018
22726bb
Silently fail on OOM errors
isaachier Mar 8, 2018
157d771
Fix test case
isaachier Mar 8, 2018
8fe3547
Fix invalid read in dynamic loading, improve test coverage
isaachier Mar 9, 2018
15899b4
Add coverage for incompatible versions
isaachier Mar 9, 2018
84e3b9c
Cover case where hook returns NULL
isaachier Mar 9, 2018
1692623
Debug Travis build
isaachier Mar 9, 2018
70f89e6
Print error message
isaachier Mar 9, 2018
92c67e9
Try fixing by using LD_LIBRARY_PATH
isaachier Mar 9, 2018
4e3f251
Remove debug printing
isaachier Mar 9, 2018
c0336f0
Revert change in build script
isaachier Mar 9, 2018
f6bd323
Silence warning on Apple clang
Mar 9, 2018
2d9f87a
Add custom format
Mar 9, 2018
9ff9437
Use enum for return type in tracer functions
Mar 9, 2018
3b2c373
Fix GCC enum C++ compat error
isaachier Mar 11, 2018
9e68cae
Temporary deployment fix for Travis
isaachier Mar 11, 2018
9101b85
Minor changes, improve coverage
isaachier Mar 11, 2018
aa80556
Add nonnull attribute to functions
isaachier Mar 11, 2018
c0dcf44
Remove temporary fix for Travis CI GitHub pages deployment
Mar 12, 2018
4854914
Document callback arguments
isaachier Mar 13, 2018
265d855
Add new propagation error code for unknown errors
isaachier Mar 14, 2018
5af501b
Update README sample code
isaachier Mar 14, 2018
5be745a
Minor changes in style and licenses
Mar 15, 2018
ade4fdb
Add clang-tidy to CMake build
Mar 15, 2018
6f85948
Add magic number
Mar 16, 2018
1207a41
Use length field along with void pointer instead of magic number
isaachier Mar 18, 2018
0bc0f80
Use pedantic errors
isaachier Mar 21, 2018
002bb7c
Add close method to tracer
isaachier Mar 23, 2018
908b164
Change null to noop
isaachier Mar 29, 2018
1cd217b
Remove format enum
Mar 30, 2018
45b58f0
Remove format from README
Mar 30, 2018
a86b022
Add methods for each propagation type
Mar 30, 2018
c584321
Update README
Mar 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Stroustrup
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<opentracing-c/'
Priority: 2
- Regex: '^<'
Priority: 1
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: C++03
TabWidth: 8
UseTab: Never
24 changes: 24 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Checks: '*,-llvm-header-guard,-clang-diagnostic-unused-command-line-argument'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
138 changes: 138 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
language: c
sudo: false
dist: trusty
addons:
apt:
packages: &1
- lcov
- valgrind
- doxygen
matrix:
include:
- os: linux
addons:
apt:
packages:
- *1
- g++-4.8
env:
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *1
- g++-4.9
env:
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *1
- g++-5
env:
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *1
- g++-6
env:
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *1
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
packages:
- *1
- clang-3.6
env:
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- *1
- clang-3.7
env:
- MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- *1
- clang-3.8
env:
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
packages:
- *1
- clang-4.0
env:
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- *1
- clang-5.0
env:
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
branches:
only:
- master
cache:
directories:
- $HOME/install
before_install:
- eval "${MATRIX_EVAL}"
- ./scripts/install-deps.sh "$HOME/install"
script:
- ./scripts/build.sh "$HOME/install"
after_success:
- ./scripts/upload-coverage.sh
- ./scripts/generate-doc.sh && touch build/doc/Debug/html/.nojekyll
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
local-dir: build/doc/Debug/html
env:
global:
- LANG="en_US.UTF-8"
- PATH="$HOME/install/bin:$PATH"
- COVERAGE="ON"
- secure: q3+0SB5x621Eh5AFUioR4c9QZONvNYRp4Du0yoVOe2Uc5TLL3VOZjStwIvhQf72aFl3/epH+DifoUJ1L2O8bbo323RZgsvwmJ6iABUwHqrga9AI9/OyIBIAvh1bqnI/8iUDrG1vcRhNx/q1PHoHSWETTyRujPNoQXuj29TveNLYkyWNuqsTyvDMaL9aqVFU2cmS2iaPIWpD5WblvyUa4e3rhonYW76SvdpCV50IYz+OUnl0SEvbdikXTP0I5YJEcHWKzia7QOSeAwbphLP2AIMe1uDvxAW+bK1pfomnqdFybvg/Fq2n4q4AHAkNL3/BTKKFSpjqFRFTiruccHrcKQzm4Gi+YzzQn+iI8sIQYQcM3He82Vmu69pg59az6y7/sJQboDVjd6xRbXBWzL9iv/bBv/PIfUCYiU8/OKmZjZUJ3xkrzBGNnKr0RtrVNt6jPkzoEPwITwN2DVWddthojD7OIYbk6H+YP9jX1sCPHORzHombff6KO2VUJo66CNCeBYJSkRqVrqCH1GleFUypeIhvG8fVbIoWytontq02aULfSXl7YLIn8ZRo3zNGKdOSZRZDh9Vz10N6tsGPvCFM27jWWxG6DSXWIXrP+dQZqiuPYQ5jeSvKsCquKGiDNfN0aJBfn6jywla2wvf0abJy7L+To+0NIMHI3TbT70rTXlvs=
93 changes: 93 additions & 0 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright (c) 2018, Uber Technologies, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import os
import ycm_core


def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )


project_dir = DirectoryOfThisScript()

flags = [
'-Wall',
'-Werror',
'-pedantic',
'-std=ansi',
'-pthread',
'-x',
'c',
'-isystem',
'/usr/local/include',
'-I',
os.path.join(project_dir, 'src'),
'-I',
os.path.join(project_dir, 'build/src')
]

compilation_database_folder = os.path.join(project_dir, 'build')

if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None

SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]


def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]


def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )


def FlagsForFile( filename, **kwargs ):
if not database:
return {
'flags': flags,
'include_paths_relative_to_dir': DirectoryOfThisScript()
}

compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None

# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object.
final_flags = list( compilation_info.compiler_flags_ )

return {
'flags': final_flags,
'include_paths_relative_to_dir': compilation_info.compiler_working_dir_
}
Loading