Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>pull/3/head
parent
6eae1a16a1
commit
71fb4a1391
@ -1,58 +0,0 @@
|
||||
# "Default" build tree
|
||||
/build/
|
||||
|
||||
# Compiled Python code
|
||||
*.pyc
|
||||
|
||||
# Testing framework (if run_tests.py is run from the source tree)
|
||||
results/
|
||||
results_2/
|
||||
|
||||
# Static analysis and code coverage
|
||||
/tests/pclint/
|
||||
/cov-int
|
||||
gcov_test/
|
||||
|
||||
# SlickEdit workspace history and tag files
|
||||
*.vtg
|
||||
*.vpwh*
|
||||
|
||||
# for projects that use Waf for building: http://code.google.com/p/waf/
|
||||
.waf-*
|
||||
.lock*
|
||||
waf*
|
||||
|
||||
# KDevelop
|
||||
*.kdev4
|
||||
.kdev4/
|
||||
|
||||
# XCode
|
||||
*.xcodeproj/*.pbxuser
|
||||
*.xcodeproj/*.perspectivev3
|
||||
*.xcodeproj/*.mode1v3
|
||||
*.xcodeproj/*.tm_build_errors
|
||||
*.tmproj
|
||||
*.xcworkspace
|
||||
xcuserdata
|
||||
|
||||
# Sublime
|
||||
*.sublime-workspace
|
||||
|
||||
# Eclipse Configuration
|
||||
.cproject
|
||||
.project
|
||||
.settings
|
||||
|
||||
# backup files
|
||||
# texteditor (kate, etc.)
|
||||
*~
|
||||
# git mergetool.keepBackup or KDiff3
|
||||
*.orig
|
||||
|
||||
# uncrustified files
|
||||
*.uncrustify
|
||||
|
||||
|
||||
# CLion
|
||||
.idea/
|
||||
cmake-build-*/
|
@ -1,198 +0,0 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# keep a test with old ubuntu version, xenial 16
|
||||
# 1
|
||||
- os: linux
|
||||
dist: Xenial
|
||||
env: BADGE=linux BUILD_TYPE=debug
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- ninja-build
|
||||
|
||||
# bionic 18
|
||||
# 2
|
||||
- os: linux
|
||||
dist: Bionic
|
||||
env: BADGE=linux BUILD_TYPE=debug
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- ninja-build
|
||||
|
||||
# Clang 4.0 address sanitizer
|
||||
# 3
|
||||
- os: linux
|
||||
dist: Bionic
|
||||
env: BADGE=linux BUILD_TYPE=asan C_COMPILER=clang-4.0 CXX_COMPILER=clang++-4.0
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-4.0
|
||||
packages:
|
||||
- clang-4.0
|
||||
|
||||
# GCC 6
|
||||
# 4
|
||||
- os: linux
|
||||
dist: Bionic
|
||||
env: BADGE=linux C_COMPILER=gcc-6 CXX_COMPILER=g++-6
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- ninja-build
|
||||
|
||||
# OSX
|
||||
# 5
|
||||
- os: osx
|
||||
env: BADGE=osx BUILD_TYPE=debug
|
||||
|
||||
# 6
|
||||
- os: osx
|
||||
env: BADGE=osx BUILD_TYPE=release
|
||||
|
||||
# focal 20
|
||||
# 7
|
||||
- os: linux
|
||||
dist: focal
|
||||
env: BADGE=linux BUILD_TYPE=debug
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- ninja-build
|
||||
|
||||
# 8
|
||||
- os: linux
|
||||
dist: focal
|
||||
env: BADGE=linux BUILD_TYPE=release
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- ninja-build
|
||||
|
||||
# 9
|
||||
- os: linux
|
||||
dist: focal
|
||||
env: BADGE=linux BUILD_TYPE=release NO_MACRO_VARARG=1
|
||||
|
||||
### Clang address sanitizer
|
||||
### 10
|
||||
##- os: linux
|
||||
## dist: focal
|
||||
## env: BADGE=linux BUILD_TYPE=asan C_COMPILER=clang-12.0 CXX_COMPILER=clang++-12.0
|
||||
## addons:
|
||||
## apt:
|
||||
## sources:
|
||||
## - ubuntu-toolchain-r-test
|
||||
## - llvm-toolchain-precise-12.0
|
||||
## packages:
|
||||
## - clang-12.0
|
||||
|
||||
# mingw-w64 Win64 cross-compile
|
||||
# 11
|
||||
- os: linux
|
||||
dist: focal
|
||||
env: BADGE=linux BUILD_TYPE=cross C_COMPILER=x86_64-w64-mingw32-gcc CXX_COMPILER=x86_64-w64-mingw32-g++
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- mingw-w64
|
||||
- binutils-mingw-w64
|
||||
- binutils-mingw-w64-i686
|
||||
- binutils-mingw-w64-x86-64
|
||||
- gcc-mingw-w64
|
||||
- gcc-mingw-w64-i686
|
||||
- gcc-mingw-w64-x86-64
|
||||
- g++-mingw-w64
|
||||
- g++-mingw-w64-i686
|
||||
- g++-mingw-w64-x86-64
|
||||
|
||||
# 12
|
||||
- os: linux
|
||||
dist: focal
|
||||
env: BUILD_TYPE=coverage COVERALLS_TOKEN="Dy94SOU3ajc1VbIy1wnWaNaeIUzfgdtEg"
|
||||
compiler: gcc
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
before_install:
|
||||
- |
|
||||
if [ "x${BUILD_TYPE}" == "xcoverage" ]; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qy python3-pip lcov
|
||||
pip3 install --user --upgrade setuptools
|
||||
pip3 install --user --upgrade pip
|
||||
pip3 install --user PyYAML
|
||||
pip3 install --user --upgrade cpp-coveralls
|
||||
fi
|
||||
- if [ -n "${C_COMPILER}" ]; then export CC="${C_COMPILER}"; fi
|
||||
- if [ -n "${CXX_COMPILER}" ]; then export CXX="${CXX_COMPILER}"; fi
|
||||
- ${CXX} --version
|
||||
- cmake --version
|
||||
- mkdir build
|
||||
- cd build
|
||||
- type -p ninja && export GENERATOR=-GNinja || true
|
||||
|
||||
before_script:
|
||||
# to stop the script after an error/warning
|
||||
- set -e
|
||||
# workarounds for OSX traivs build failure issues:
|
||||
# 1. rvm overrides cd with a function so that it can hook into it to run some scripts from the new
|
||||
# working directory. The workaround is to revert it to the builtin shell one.
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then unset -f cd; fi
|
||||
# 2. Redefine shell_session_update as a dummy function to avoid travis error:
|
||||
# /Users/travis/.rvm/scripts/functions/support: line 57: shell_session_update: command not found.
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then shell_session_update() { :; }; fi
|
||||
# prepare make files with cmake
|
||||
- |-
|
||||
case "${BUILD_TYPE}" in
|
||||
"coverage")
|
||||
cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_CODECOVERAGE=ON ..
|
||||
;;
|
||||
"asan")
|
||||
cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZER=address ..
|
||||
;;
|
||||
"ubsan")
|
||||
cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZER=undefined ..
|
||||
;;
|
||||
"cross")
|
||||
cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DCMAKE_EXE_LINKER_FLAGS="-static -s" ..
|
||||
;;
|
||||
"release")
|
||||
cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Release ..
|
||||
;;
|
||||
*)
|
||||
cmake ${GENERATOR} ..
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
script:
|
||||
# build
|
||||
- if [ -f build.ninja ]; then ninja -v; else make VERBOSE=1; fi
|
||||
# run all tests
|
||||
- if [ "x${BUILD_TYPE}" != "xcross" ]; then ../scripts/run_ctest.py; fi
|
||||
# collect coverage (needs to be after running tests)
|
||||
- if [ "x${BUILD_TYPE}" == "xcoverage" ]; then make coverage; fi
|
||||
|
||||
# DO NOT REMOVE (debugging purposes)
|
||||
#- /home/travis/build/uncrustify/uncrustify/build/uncrustify -l cs -c /home/travis/build/uncrustify/uncrustify/tests/config/U10-Cpp.cfg -f /home/travis/build/uncrustify/uncrustify/tests/input/cs/newlines.mm -L A
|
||||
|
||||
after_success:
|
||||
# publish coverage data to coveralls
|
||||
- if [ "x${BUILD_TYPE}" == "xcoverage" ]; then cd ../ && coveralls -l build/cmake_coverage.output -t $COVERALLS_TOKEN; fi
|
@ -1,138 +0,0 @@
|
||||
Author:
|
||||
2005 - 2016 : Ben Gardner
|
||||
|
||||
Maintenance:
|
||||
Guy Maurel
|
||||
Matthew Woehlke
|
||||
|
||||
until 2020-11-05:
|
||||
Other collaborators:
|
||||
Alan Fineberg
|
||||
Alexander GQ Gerasiov
|
||||
Andrรฉ Berg
|
||||
Andrei Alexandrescu
|
||||
Andrey Starodubtsev
|
||||
Anirban Pramanick
|
||||
Antti Tapaninen
|
||||
Arne Forlie
|
||||
Arseniy Shestakov
|
||||
Aurรฉlien Gรขteau
|
||||
Benio
|
||||
Ben Iofel
|
||||
Ben Mayo
|
||||
Beren Minor
|
||||
B. Kevin Hardman
|
||||
Bogdan Popescu
|
||||
Brandon Slack
|
||||
Brendan Long
|
||||
Chris Lalancette
|
||||
Clemens Rabe
|
||||
Code Able
|
||||
Cody Schafer
|
||||
Corentin Noรซl
|
||||
Daniel Chumak
|
||||
Dan Rose
|
||||
Dave Lee
|
||||
David Catmull
|
||||
David Lechner
|
||||
David Schaefgen
|
||||
Dirk Thomas
|
||||
Dittrich, Rico
|
||||
Dmitry Marakasov
|
||||
Dmitry Povolotsky
|
||||
Dmytro Povolotskyi
|
||||
Dลพenan Zukiฤ
|
||||
Emerson Knapp
|
||||
Emmanuel Christophe
|
||||
Ethan Gao
|
||||
Florin Pop
|
||||
Gary Ash
|
||||
Ger Hobbelt
|
||||
Hackerpilot
|
||||
Hannes Schmidt
|
||||
Huang-Ming Huang
|
||||
Ilya Lyubimov
|
||||
Ingo Brรผckl
|
||||
Ivan Nazarenko
|
||||
Ivan Romanov
|
||||
Jakub Schmidtke
|
||||
Jan Weiร
|
||||
Jason
|
||||
Jeremy H
|
||||
Jeremy T Hilliker
|
||||
Jim Meyering
|
||||
Jiri Hruska
|
||||
Joel Ostraat
|
||||
Joergen Ibsen
|
||||
Johnny Oskarsson
|
||||
Jonas Hurrelmann
|
||||
Joshua Gross
|
||||
Joshua Parker
|
||||
Julian Picht
|
||||
Kalle Raiskila
|
||||
Keepun
|
||||
krys
|
||||
Laurent Trรฉguier
|
||||
Lauri Kasanen
|
||||
lbmaian
|
||||
Leon Breedt
|
||||
Lorenz Haas
|
||||
Lykurg
|
||||
Marco Stephan
|
||||
Marek Fort
|
||||
Marius Zwicker
|
||||
Mark Stegeman
|
||||
Markus Geimer
|
||||
Martin Simonovsky
|
||||
Martin Storsjo
|
||||
Matthew McDole
|
||||
Matthew Woehlke
|
||||
Maxim Mikityanskiy
|
||||
Max Smolens
|
||||
Michaรซl Peeters
|
||||
Mihai Popescu
|
||||
Mike
|
||||
Mike Gelfand
|
||||
Mirko Kรถnig
|
||||
MrTheMake
|
||||
Nate
|
||||
Nico Decker
|
||||
Oleg Liatte
|
||||
Oleg Smolsky
|
||||
Owen Rudge
|
||||
Pat Notz
|
||||
Patrick Rohr
|
||||
Paul Smith
|
||||
Pavel Geiger
|
||||
Pawel Benetkiewicz
|
||||
PerfectCarl
|
||||
Peter Bruin
|
||||
Peter Hartley
|
||||
Peter Jonas
|
||||
Peter Kolbus
|
||||
Peter Waller
|
||||
Piet Van Reepingen
|
||||
Randolph R. Settgast
|
||||
Randolph Settgast
|
||||
RaveTheTadpole
|
||||
Roland Schulz
|
||||
Ryan Maxwell
|
||||
Samish Chandra Kolli
|
||||
Scott Bilas
|
||||
S. Gilles
|
||||
Shazron Abdullah
|
||||
Siddharth Kannan
|
||||
Stefan Koch
|
||||
Stefan Nunninger
|
||||
Stephen Gilles
|
||||
Steven Lee
|
||||
Suhaib Ishaque
|
||||
Tim Hรผtz
|
||||
Timotheus Pokorra
|
||||
Todd Richmond
|
||||
Twigz
|
||||
Vadim Zeitlin
|
||||
Viktor Kireev
|
||||
Vincent Rouilleฬ
|
||||
Vyacheslav Shegai
|
||||
Waldir Pimenta
|
@ -1,534 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(uncrustify)
|
||||
|
||||
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
|
||||
message(FATAL_ERROR "
|
||||
In-source builds are not supported, please remove the `CMakeFiles'
|
||||
folder and `CMakeCache.txt', and create a folder for the build:
|
||||
mkdir build; cd build; cmake ..
|
||||
")
|
||||
endif()
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckCXXSymbolExists)
|
||||
include(CheckTypeSize)
|
||||
include(CTest)
|
||||
|
||||
find_package(PythonInterp REQUIRED)
|
||||
|
||||
#
|
||||
# Check compiler flags
|
||||
#
|
||||
if(MSVC)
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /wd4267)
|
||||
add_definitions(/utf-8)
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(gcc_warning_flags
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wshadow
|
||||
-Wpointer-arith
|
||||
-Wcast-qual
|
||||
-Wcast-align
|
||||
-Wc++11-extensions
|
||||
)
|
||||
foreach(flag ${gcc_warning_flags})
|
||||
string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" flag_var "CXXFLAG_${flag}")
|
||||
CHECK_CXX_COMPILER_FLAG("${flag}" ${flag_var})
|
||||
if(${flag_var})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
endif()
|
||||
unset(flag_var)
|
||||
endforeach()
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers")
|
||||
endif()
|
||||
unset(gcc_warning_flags)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
|
||||
if(ENABLE_SANITIZER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fno-omit-frame-pointer -fsanitize=${ENABLE_SANITIZER}")
|
||||
endif()
|
||||
|
||||
#set(UNCRUSTIFY_SEPARATE_TESTS "True")
|
||||
|
||||
include_directories(
|
||||
${PROJECT_BINARY_DIR}/src
|
||||
${PROJECT_SOURCE_DIR}/src
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
#
|
||||
# Determine config
|
||||
#
|
||||
if(WIN32)
|
||||
# Windows builds use src/windows_compat.h instead of config.h
|
||||
else()
|
||||
# Generate config.h
|
||||
set(avail_headers "")
|
||||
|
||||
set(headers
|
||||
inttypes.h
|
||||
memory.h
|
||||
stdint.h
|
||||
stdlib.h
|
||||
strings.h
|
||||
string.h
|
||||
sys/stat.h
|
||||
sys/types.h
|
||||
unistd.h
|
||||
utime.h
|
||||
)
|
||||
foreach(header ${headers})
|
||||
string(TOUPPER "${header}" header_uc)
|
||||
string(REGEX REPLACE "[^A-Z0-9_]" "_" include_var "HAVE_${header_uc}")
|
||||
check_include_file_cxx("${header}" ${include_var})
|
||||
if(${include_var})
|
||||
list(APPEND avail_headers ${header})
|
||||
endif()
|
||||
unset(include_var)
|
||||
unset(header_uc)
|
||||
endforeach()
|
||||
unset(headers)
|
||||
|
||||
check_include_file("stdbool.h" HAVE_STDBOOL_H)
|
||||
|
||||
set(symbols
|
||||
memset
|
||||
strcasecmp
|
||||
strchr
|
||||
strdup
|
||||
strerror
|
||||
strtol
|
||||
strtoul
|
||||
)
|
||||
foreach(symbol ${symbols})
|
||||
string(TOUPPER "${symbol}" symbol_uc)
|
||||
string(REGEX REPLACE "[^A-Z0-9_]" "_" symbol_var "HAVE_${symbol_uc}")
|
||||
check_cxx_symbol_exists("${symbol}" "${avail_headers}" ${symbol_var})
|
||||
unset(symbol_var)
|
||||
unset(symbol_uc)
|
||||
endforeach()
|
||||
unset(symbols)
|
||||
|
||||
unset(avail_headers)
|
||||
|
||||
check_type_size(_Bool _BOOL LANGUAGE C)
|
||||
|
||||
configure_file(src/config.h.in config.h @ONLY)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Generate uncrustify_version.h
|
||||
#
|
||||
|
||||
set(UNCRUSTIFY_VERSION "0.72.0_f")
|
||||
|
||||
option(NoGitVersionString "Do not use make_version.py and git to build a version string" OFF)
|
||||
if(NoGitVersionString)
|
||||
configure_file(src/uncrustify_version.h.in uncrustify_version.h @ONLY)
|
||||
add_custom_target(generate_version_header) # Dummy target
|
||||
else()
|
||||
# Add target to generate version header;
|
||||
# do this every build to ensure git SHA is up to date
|
||||
add_custom_target(generate_version_header
|
||||
BYPRODUCTS "${PROJECT_BINARY_DIR}/uncrustify_version.h"
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-D PYTHON_EXECUTABLE:STRING=${PYTHON_EXECUTABLE}
|
||||
-D SOURCE_DIR:PATH="${PROJECT_SOURCE_DIR}"
|
||||
-D INPUT:PATH="${PROJECT_SOURCE_DIR}/src/uncrustify_version.h.in"
|
||||
-D OUTPUT:PATH="${PROJECT_BINARY_DIR}/uncrustify_version.h"
|
||||
-D UNCRUSTIFY_VERSION:STRING="${UNCRUSTIFY_VERSION}"
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/GenerateVersionHeader.cmake
|
||||
COMMENT "Generating version header"
|
||||
)
|
||||
set_source_files_properties(
|
||||
"${PROJECT_BINARY_DIR}/uncrustify_version.h"
|
||||
PROPERTIES GENERATED TRUE
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Generate token_names.h
|
||||
#
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/token_names.h"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-Dsrc_file=${PROJECT_SOURCE_DIR}/src/token_enum.h"
|
||||
"-Ddst_file=${CMAKE_CURRENT_BINARY_DIR}/token_names.h"
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/GenerateTokenNames.cmake"
|
||||
MAIN_DEPENDENCY src/token_enum.h
|
||||
COMMENT "Generating token_names.h"
|
||||
)
|
||||
|
||||
# Set up commands for generated source files
|
||||
function(py_gen OUTPUT SCRIPT INPUT)
|
||||
set(out "${PROJECT_BINARY_DIR}/src/${OUTPUT}")
|
||||
set(deps "${PROJECT_SOURCE_DIR}/src/${INPUT}")
|
||||
get_filename_component(outdir "${out}" DIRECTORY)
|
||||
foreach(arg IN LISTS ARGN)
|
||||
if (IS_ABSOLUTE "${arg}")
|
||||
list(APPEND deps "${arg}")
|
||||
else()
|
||||
list(APPEND deps "${PROJECT_SOURCE_DIR}/src/${arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${out}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${outdir}"
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
"${PROJECT_SOURCE_DIR}/scripts/${SCRIPT}"
|
||||
"${out}"
|
||||
${deps}
|
||||
DEPENDS ${deps} "${PROJECT_SOURCE_DIR}/scripts/${SCRIPT}"
|
||||
MAIN_DEPENDENCY src/${INPUT}
|
||||
COMMENT "Generating ${OUTPUT}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
py_gen(punctuator_table.h
|
||||
make_punctuator_table.py
|
||||
symbols_table.h
|
||||
)
|
||||
|
||||
py_gen(options.cpp
|
||||
make_options.py
|
||||
options.h
|
||||
options.cpp.in
|
||||
)
|
||||
|
||||
py_gen(option_enum.h
|
||||
make_option_enum.py
|
||||
option.h
|
||||
option_enum.h.in
|
||||
)
|
||||
|
||||
py_gen(option_enum.cpp
|
||||
make_option_enum.py
|
||||
option.h
|
||||
option_enum.cpp.in
|
||||
)
|
||||
|
||||
py_gen(../etc/uncrustify.xml
|
||||
make_katehl.py
|
||||
../etc/uncrustify.xml.in
|
||||
"${PROJECT_BINARY_DIR}/uncrustify_version.h"
|
||||
options.h
|
||||
option.h
|
||||
token_enum.h
|
||||
)
|
||||
|
||||
#
|
||||
# Uncrustify
|
||||
#
|
||||
set(uncrustify_sources
|
||||
src/align_add.cpp
|
||||
src/align_asm_colon.cpp
|
||||
src/align_assign.cpp
|
||||
src/align.cpp
|
||||
src/align_eigen_comma_init.cpp
|
||||
src/align_func_params.cpp
|
||||
src/align_func_proto.cpp
|
||||
src/align_init_brace.cpp
|
||||
src/align_left_shift.cpp
|
||||
src/align_log_al.cpp
|
||||
src/align_nl_cont.cpp
|
||||
src/align_oc_decl_colon.cpp
|
||||
src/align_oc_msg_colons.cpp
|
||||
src/align_oc_msg_spec.cpp
|
||||
src/align_preprocessor.cpp
|
||||
src/align_same_func_call_params.cpp
|
||||
src/align_stack.cpp
|
||||
src/align_struct_initializers.cpp
|
||||
src/align_tab_column.cpp
|
||||
src/align_tools.cpp
|
||||
src/align_trailing_comments.cpp
|
||||
src/align_typedefs.cpp
|
||||
src/align_var_def_brace.cpp
|
||||
src/args.cpp
|
||||
src/backup.cpp
|
||||
src/brace_cleanup.cpp
|
||||
src/braces.cpp
|
||||
src/chunk_list.cpp
|
||||
src/ChunkStack.cpp
|
||||
src/combine.cpp
|
||||
src/combine_fix_mark.cpp
|
||||
src/combine_labels.cpp
|
||||
# src/combine_mark.cpp
|
||||
src/combine_tools.cpp
|
||||
src/combine_skip.cpp
|
||||
src/compat_posix.cpp
|
||||
src/compat_win32.cpp
|
||||
src/cs_top_is_question.cpp
|
||||
src/detect.cpp
|
||||
src/enum_cleanup.cpp
|
||||
src/flag_braced_init_list.cpp
|
||||
src/flag_decltype.cpp
|
||||
src/flag_parens.cpp
|
||||
src/frame_list.cpp
|
||||
# src/handle_oc.cpp
|
||||
src/indent.cpp
|
||||
src/keywords.cpp
|
||||
src/lang_pawn.cpp
|
||||
src/language_tools.cpp
|
||||
src/logger.cpp
|
||||
src/logmask.cpp
|
||||
src/log_rules.cpp
|
||||
src/md5.cpp
|
||||
src/newlines.cpp
|
||||
src/option.cpp
|
||||
src/options_for_QT.cpp
|
||||
src/output.cpp
|
||||
src/parens.cpp
|
||||
src/ParseFrame.cpp
|
||||
src/pcf_flags.cpp
|
||||
src/punctuators.cpp
|
||||
src/quick_align_again.cpp
|
||||
src/remove_extra_returns.cpp
|
||||
src/semicolons.cpp
|
||||
src/sorting.cpp
|
||||
src/space.cpp
|
||||
src/tokenize_cleanup.cpp
|
||||
src/tokenize.cpp
|
||||
src/uncrustify.cpp
|
||||
src/uncrustify_emscripten.cpp
|
||||
src/uncrustify_types.cpp
|
||||
src/unc_text.cpp
|
||||
src/unc_tools.cpp
|
||||
src/unicode.cpp
|
||||
src/universalindentgui.cpp
|
||||
src/width.cpp
|
||||
${PROJECT_BINARY_DIR}/src/options.cpp
|
||||
${PROJECT_BINARY_DIR}/src/option_enum.cpp
|
||||
)
|
||||
|
||||
set(uncrustify_headers
|
||||
src/align_add.h
|
||||
src/align_asm_colon.h
|
||||
src/align_assign.h
|
||||
src/align_func_params.h
|
||||
src/align_func_proto.h
|
||||
src/align.h
|
||||
src/align_eigen_comma_init.h
|
||||
src/align_init_brace.h
|
||||
src/align_left_shift.h
|
||||
src/align_log_al.h
|
||||
src/align_nl_cont.h
|
||||
src/align_oc_decl_colon.h
|
||||
src/align_oc_msg_colons.h
|
||||
src/align_oc_msg_spec.h
|
||||
src/align_preprocessor.h
|
||||
src/align_same_func_call_params.h
|
||||
src/align_stack.h
|
||||
src/align_struct_initializers.h
|
||||
src/align_tab_column.h
|
||||
src/align_tools.h
|
||||
src/align_trailing_comments.h
|
||||
src/align_typedefs.h
|
||||
src/align_var_def_brace.h
|
||||
src/args.h
|
||||
src/backup.h
|
||||
src/base_types.h
|
||||
src/brace_cleanup.h
|
||||
src/braces.h
|
||||
src/char_table.h
|
||||
src/chunk_list.h
|
||||
src/ChunkStack.h
|
||||
src/combine.h
|
||||
src/combine_fix_mark.h
|
||||
src/combine_labels.h
|
||||
# src/combine_mark.h
|
||||
src/combine_skip.h
|
||||
src/combine_tools.h
|
||||
src/compat.h
|
||||
src/cs_top_is_question.h
|
||||
src/detect.h
|
||||
src/enum_cleanup.h
|
||||
src/enum_flags.h
|
||||
src/error_types.h
|
||||
src/flag_braced_init_list.h
|
||||
src/flag_decltype.h
|
||||
src/flag_parens.h
|
||||
src/frame_list.h
|
||||
# src/handle_oc.h
|
||||
src/indent.h
|
||||
src/keywords.h
|
||||
src/lang_pawn.h
|
||||
src/language_tools.h
|
||||
src/ListManager.h
|
||||
src/logger.h
|
||||
src/log_levels.h
|
||||
src/logmask.h
|
||||
src/log_rules.h
|
||||
src/md5.h
|
||||
src/newlines.h
|
||||
src/option.h
|
||||
src/options_for_QT.h
|
||||
src/options.h
|
||||
src/output.h
|
||||
src/parens.h
|
||||
src/ParseFrame.h
|
||||
src/pcf_flags.h
|
||||
src/prototypes.h
|
||||
src/punctuators.h
|
||||
src/quick_align_again.h
|
||||
src/remove_extra_returns.h
|
||||
src/semicolons.h
|
||||
src/sorting.h
|
||||
src/space.h
|
||||
src/symbols_table.h
|
||||
src/token_enum.h
|
||||
src/tokenize_cleanup.h
|
||||
src/tokenize.h
|
||||
src/unc_ctype.h
|
||||
src/uncrustify.h
|
||||
src/uncrustify_limits.h
|
||||
src/uncrustify_types.h
|
||||
src/unc_text.h
|
||||
src/unc_tools.h
|
||||
src/unicode.h
|
||||
src/universalindentgui.h
|
||||
src/width.h
|
||||
src/windows_compat.h
|
||||
${PROJECT_BINARY_DIR}/src/option_enum.h
|
||||
${PROJECT_BINARY_DIR}/uncrustify_version.h
|
||||
)
|
||||
|
||||
set(uncrustify_docs
|
||||
"${PROJECT_SOURCE_DIR}/AUTHORS"
|
||||
"${PROJECT_SOURCE_DIR}/BUGS"
|
||||
"${PROJECT_SOURCE_DIR}/ChangeLog"
|
||||
"${PROJECT_SOURCE_DIR}/COPYING"
|
||||
"${PROJECT_SOURCE_DIR}/HELP"
|
||||
"${PROJECT_SOURCE_DIR}/README.md"
|
||||
)
|
||||
|
||||
add_executable(uncrustify ${uncrustify_sources} ${uncrustify_headers})
|
||||
add_dependencies(uncrustify generate_version_header)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.10)
|
||||
if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
|
||||
# Multi-configuration or build type set
|
||||
set_property(TARGET uncrustify APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS_DEBUG DEBUG
|
||||
)
|
||||
else()
|
||||
# Single-configuration with no build type set
|
||||
set_property(TARGET uncrustify APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS DEBUG
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set_property(TARGET uncrustify APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS $<$<OR:$<CONFIG:Debug>,$<CONFIG:>>:DEBUG>
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Generate uncrustify.1
|
||||
#
|
||||
configure_file(man/uncrustify.1.in uncrustify.1 @ONLY)
|
||||
|
||||
#
|
||||
# Generate uncrustify.xml (katepart highlighting file)
|
||||
#
|
||||
add_custom_target(katehl
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/etc/uncrustify.xml
|
||||
)
|
||||
|
||||
#
|
||||
# Tests
|
||||
#
|
||||
if(BUILD_TESTING)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Coverage
|
||||
#
|
||||
OPTION(ENABLE_CODECOVERAGE "Enable code coverage testing support")
|
||||
if(ENABLE_CODECOVERAGE)
|
||||
set(CODECOVERAGE_DEPENDS uncrustify)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake)
|
||||
endif(ENABLE_CODECOVERAGE)
|
||||
|
||||
#
|
||||
# Build command to run uncrustify on its own sources
|
||||
#
|
||||
add_custom_target(format-sources)
|
||||
foreach(source IN LISTS uncrustify_sources uncrustify_headers)
|
||||
get_filename_component(source_name ${source} NAME)
|
||||
add_custom_target(format-${source_name}
|
||||
COMMAND uncrustify
|
||||
-c forUncrustifySources.cfg
|
||||
-lCPP --no-backup ${source}
|
||||
COMMENT "Formatting ${source}"
|
||||
WORKING_DIRECTORY ${uncrustify_SOURCE_DIR}
|
||||
)
|
||||
add_dependencies(format-sources format-${source_name})
|
||||
endforeach()
|
||||
|
||||
#
|
||||
# Package
|
||||
#
|
||||
set(CPACK_PACKAGE_NAME "uncrustify")
|
||||
set(CPACK_PACKAGE_VERSION "${UNCRUSTIFY_VERSION}")
|
||||
set(CPACK_PACKAGE_VENDOR "Ben Gardner")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Code beautifier")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
|
||||
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.hg/;/tests/results/;/build.*/")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
endif()
|
||||
include(CPack)
|
||||
|
||||
#
|
||||
# Install
|
||||
#
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
install(TARGETS uncrustify DESTINATION ".")
|
||||
install(FILES ${uncrustify_docs}
|
||||
DESTINATION "."
|
||||
)
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/documentation/htdocs/index.html"
|
||||
DESTINATION "doc"
|
||||
)
|
||||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/etc/"
|
||||
DESTINATION "cfg"
|
||||
FILES_MATCHING PATTERN "*.cfg"
|
||||
)
|
||||
else()
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS uncrustify
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/uncrustify.1"
|
||||
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
|
||||
)
|
||||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/etc/"
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples"
|
||||
FILES_MATCHING PATTERN "*.cfg"
|
||||
)
|
||||
install(FILES ${uncrustify_docs}
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# add to build the compile_commands.json file, to be used by clang-tidy
|
||||
#
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON" CACHE BOOL "to create the compile_commands.json file" FORCE)
|
@ -1,87 +0,0 @@
|
||||
# Contributing to Uncrustify
|
||||
|
||||
## How to contribute
|
||||
|
||||
There are lots of ways to contribute to Uncrustify:
|
||||
|
||||
- Report Issues
|
||||
|
||||
- Propose Features or Improvements
|
||||
|
||||
- Submit Pull Requests
|
||||
|
||||
## Making changes
|
||||
|
||||
* Pull latest [master][master] and create a new branch:
|
||||
- Branch name _should_ use lowercase, using `-` to separate words
|
||||
and not `_`. Other special characters _should_ be avoided.
|
||||
(However, feel free to use option names verbatim in branch names;
|
||||
`_` _should_ be used when part of an option name.)
|
||||
- A hierarchical structure _may_ be designated using `/`
|
||||
(e.g. `area/topic`), although this is uncommon.
|
||||
The last part of the name can be keywords like `bugfix`, `feature`,
|
||||
`optim`, `docs`, `refactor`, `test`, etc.
|
||||
- Branches _should_ be named after _what_ the change is about.
|
||||
- Branches _should not_ be named after the issue number,
|
||||
developer name, etc.
|
||||
|
||||
* Organize your work:
|
||||
- Specialize your branch to target only one thing.
|
||||
Split your work in multiple branches if necessary.
|
||||
- Make commits of logical units.
|
||||
- Avoid "fix-up" commits.
|
||||
Instead, rewrite your history so that the original commit is "clean".
|
||||
- Try to write a [quality commit message][commits]:
|
||||
+ Separate subject line from body with a blank line.
|
||||
+ Limit subject line to 50 characters.
|
||||
+ Capitalize the subject line.
|
||||
+ Do not end the subject line with a period.
|
||||
+ Use imperative present tense in the subject line.
|
||||
A proper subject can complete the sentence
|
||||
"If applied, this commit will, [subject]".
|
||||
+ Wrap the body at 72 characters.
|
||||
+ Include motivation for the change
|
||||
and contrast its implementation with previous behavior.
|
||||
Explain the _what_ and _why_ instead of _how_.
|
||||
- If the git diff command, or the diff part of the git gui,
|
||||
don't produce accurate output, it might be necessary to add
|
||||
some lines to the ~/.gitconfig file:
|
||||
[diff]
|
||||
algorithm = patience
|
||||
[gui]
|
||||
diffopts = --patience
|
||||
|
||||
|
||||
* Add or update unit tests:
|
||||
- All behavioral changes should come with a unit test that verifies
|
||||
that the new feature or fixed issue works as expected.
|
||||
- Consider improving existing tests if it makes sense to do so.
|
||||
- Any unused test number may be used,
|
||||
however it is preferred to keep related tests together, if possible.
|
||||
- Read [Writing Tests][tests] for more details.
|
||||
|
||||
* Polish your work:
|
||||
- The code should be clean, with documentation where needed.
|
||||
- The change must be complete (no upcoming fix-up commits).
|
||||
- Functional changes should always be accompanied by tests (see above).
|
||||
Changes without tests should explain why tests are not present.
|
||||
(Changes that are non-functional, such as documentation changes,
|
||||
can usually omit tests without justification.)
|
||||
|
||||
* Prepare a Pull Request (PR):
|
||||
- To reduce the likelihood of conflicts and test failures,
|
||||
consider rebasing your work on top of latest master before creating a PR.
|
||||
- Verify that your code is working properly
|
||||
by running `ctest` in your build directory.
|
||||
(Changes that fail CI will _not_ be merged.
|
||||
Running the tests locally will help to avoid this.)
|
||||
You can change the level of logging by changing the line 104 and 109
|
||||
of the file tests/test_uncrustify/test.py to another value.
|
||||
- The PR title should represent _what_ is being changed
|
||||
(a rephrasing of the branch name if set correctly).
|
||||
- The PR description should document the _why_ the change needed to be done
|
||||
and not _how_, which should be obvious by doing the code review.
|
||||
|
||||
[master]: https://github.com/uncrustify/uncrustify/tree/master
|
||||
[commits]: https://chris.beams.io/posts/git-commit/
|
||||
[tests]: https://github.com/uncrustify/uncrustify/wiki/Writing-Tests
|
File diff suppressed because it is too large
Load Diff
@ -1,374 +0,0 @@
|
||||
[![Travis CI](http://badges.herokuapp.com/travis/uncrustify/uncrustify?style=flat-square&env=BADGE=linux&label=Linux&branch=master)](https://travis-ci.org/uncrustify/uncrustify)
|
||||
[![Travis CI](http://badges.herokuapp.com/travis/uncrustify/uncrustify?style=flat-square&env=BADGE=osx&label=OSX&branch=master)](https://travis-ci.org/uncrustify/uncrustify)
|
||||
[![AppVeyor](https://img.shields.io/appveyor/ci/uncrustify/uncrustify/master.svg?style=flat-square&label=Windows)](https://ci.appveyor.com/project/uncrustify/uncrustify)
|
||||
[![Coverity](https://scan.coverity.com/projects/8264/badge.svg)](https://scan.coverity.com/projects/uncrustify)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/uncrustify/uncrustify/badge.svg?branch=master)](https://coveralls.io/github/uncrustify/uncrustify?branch=master)
|
||||
<a href="#"><img src="https://img.shields.io/badge/C++-11-blue.svg?style=flat-square"></a>
|
||||
|
||||
---------------------------
|
||||
|
||||
# Uncrustify
|
||||
A source code beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA
|
||||
|
||||
## Features
|
||||
* Highly configurable - 742 configurable options as of version 0.72.0
|
||||
- <details><summary>add/remove spaces</summary>
|
||||
|
||||
- `sp_before_sparen`: _Add or remove space before '(' of 'if', 'for', 'switch', 'while', etc._
|
||||
- `sp_compare`: _Add or remove space around compare operator '<', '>', '==', etc_
|
||||
</details>
|
||||
|
||||
- <details><summary>add/remove newlines</summary>
|
||||
|
||||
- `nl_if_brace`: _Add or remove newline between 'if' and '{'_
|
||||
- `nl_brace_while`: _Add or remove newline between '}' and 'while' of 'do' statement_
|
||||
</details>
|
||||
|
||||
- <details><summary>add/remove blanklines</summary>
|
||||
|
||||
- `eat_blanks_before_close_brace`: _Whether to remove blank lines before '}'_
|
||||
- `nl_max`: _The maximum consecutive newlines (3 = 2 blank lines)_
|
||||
</details>
|
||||
|
||||
- <details><summary>indent code</summary>
|
||||
|
||||
- `indent_switch_case`: _indent_switch_case: Spaces to indent 'case' from 'switch'_
|
||||
- `indent_class_colon`: _Whether to indent the stuff after a leading base class colon_
|
||||
</details>
|
||||
|
||||
- <details><summary>align code</summary>
|
||||
|
||||
- `align_func_params`: _Align variable definitions in prototypes and functions_
|
||||
- `align_struct_init_span`: _The span for aligning struct initializer values (0=don't align)_
|
||||
</details>
|
||||
|
||||
- <details><summary>modify code</summary>
|
||||
|
||||
- `mod_full_brace_for`: _Add or remove braces on single-line 'for' statement_
|
||||
- `mod_paren_on_return`: _Add or remove unnecessary paren on 'return' statement_
|
||||
</details>
|
||||
|
||||
Here is an example [configuration file](https://raw.githubusercontent.com/uncrustify/uncrustify/master/documentation/htdocs/ben.cfg.txt),
|
||||
and here is a [before](https://raw.githubusercontent.com/uncrustify/uncrustify/master/documentation/htdocs/examples/c-1.in.c)
|
||||
and [after](https://raw.githubusercontent.com/uncrustify/uncrustify/master/documentation/htdocs/examples/c-1.out.c)
|
||||
C source example.
|
||||
That should give you a pretty good idea of what Uncrustify can do.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
## Binaries
|
||||
Pre compiled binaries for Windows can be downloaded [here](https://sourceforge.net/projects/uncrustify/files/uncrustify/).
|
||||
|
||||
## Build
|
||||
[Python](https://www.python.org/) is an "interpreted high-level programming language for general-purpose programming", for this project it is needed to extend the capabilities of CMake.
|
||||
|
||||
[CMake](https://cmake.org/) is a tool that generates build systems
|
||||
(Makefiles, Visual Studio project files, Xcode project files and others).
|
||||
|
||||
To generate a build system for Uncrustify using CMake, create a build
|
||||
folder and run CMake from it:
|
||||
|
||||
```bash
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
```
|
||||
(Use `cmake -G Xcode ..` for Xcode)
|
||||
|
||||
Then use the build tools of your build system (in many cases this will
|
||||
simply be `make`, but on Windows it could be MSBuild or Visual Studio).
|
||||
Or use CMake to invoke it:
|
||||
|
||||
```bash
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
If testing is enabled, CMake generates a `test` target, which you can
|
||||
_build_ using your build system tools (usually `make test`). This can also
|
||||
be invoked using CTest:
|
||||
|
||||
```bash
|
||||
$ ctest -V -C Debug
|
||||
```
|
||||
|
||||
There is also an `install` target, which can be used to install the
|
||||
Uncrustify executable (typically `make install`).
|
||||
|
||||
### A note on CMake configurations
|
||||
Some build systems are single-configuration, which means you specify the
|
||||
build type when running CMake (by setting the `CMAKE_BUILD_TYPE`
|
||||
variable), and the generated files then build that configuration.
|
||||
|
||||
An example of a single-configuration build system are Makefiles. You can
|
||||
build the Release configuration of Uncrustify (from the build folder) with:
|
||||
|
||||
```bash
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
$ make
|
||||
```
|
||||
|
||||
Other build systems are multi-configuration, which means you specify the
|
||||
build type when building.
|
||||
|
||||
An example of a multi-configuration build system are Visual Studios project
|
||||
files. When you open the project in Visual Studio, you can select which
|
||||
configuration to build. You can also do this while building from the
|
||||
command line with `cmake --build . --config Release`.
|
||||
|
||||
|
||||
## Bugs
|
||||
Post any bugs to the issue tracker found on the projects GitHub page:
|
||||
https://github.com/uncrustify/uncrustify/issues
|
||||
|
||||
Please include the following with your issue:
|
||||
- a description of what is not working right
|
||||
- input code sufficient to demonstrate the issue
|
||||
- expected output code
|
||||
- configuration options used to generate the output
|
||||
|
||||
More about this is in the [ISSUE_TEMPLATE](https://github.com/uncrustify/uncrustify/blob/master/.github/ISSUE_TEMPLATE)
|
||||
|
||||
|
||||
### Known problems
|
||||
[Look at the Wiki](https://github.com/uncrustify/uncrustify/wiki/Known-Problems)
|
||||
|
||||
|
||||
## Which repositories have uncrustify?
|
||||
[Look here](https://repology.org/metapackage/uncrustify/versions)
|
||||
|
||||
|
||||
## Contribute
|
||||
If you want to add a feature, fix a bug, or implement missing
|
||||
functionality, feel free to do so! Patches are welcome!
|
||||
Here are some areas that need attention:
|
||||
|
||||
- __Patches for Objective-C support__. We really need someone who knows
|
||||
this language as it has more than plenty open issues. A good starting
|
||||
point would be to integrate changes made in the
|
||||
[Unity fork](https://github.com/Unity-Technologies/uncrustify/tree/fixes/c-oc-java)
|
||||
- Test Java support and provide feedback (or patches!)
|
||||
- Test Embedded SQL to see what works
|
||||
- A logo of some sort
|
||||
- Anything else that you want to do to make it better?
|
||||
|
||||
### A note about pull requests
|
||||
Firstly take a look at the [CONTRIBUTING.md](https://github.com/uncrustify/uncrustify/blob/master/CONTRIBUTING.md)
|
||||
|
||||
Currently we have two continuous integration systems that test your PRs,
|
||||
TravisCI and Appveyor.
|
||||
Tested are the test cases, the formatting of the code base and
|
||||
the output of the command line options.
|
||||
|
||||
Test cases can be found in the `tests/` directory. Every file ending with
|
||||
`.test` is a test set. Inside each line with these components is a
|
||||
single test: `testNr[!] testConfigFileName testInputFileName [lang]`
|
||||
|
||||
The configuration file `testConfigFileName` has to be located inside `tests/config`,
|
||||
the input file `testInputFileName` inside `tests/input/<testSetName>/`,
|
||||
and expected results file inside the `tests/expected/<testSetName>/`
|
||||
directory.
|
||||
Expected results have the following naming convention: `testNr-testConfigFileName`.
|
||||
|
||||
Optionally a `!` can follow the `testNr` to enable a custom rerun
|
||||
configuration.
|
||||
Rerun configurations need to be named like this:
|
||||
`testConfigFileName`(without extension)+`.rerun`+`.extension`
|
||||
|
||||
Also, optionally a language for the input can be provided with `lang`.
|
||||
|
||||
The codebase has to be formatted by the options set up in
|
||||
`forUncrustifySources.cfg`. Failing to format the sources correctly will
|
||||
cause TravisCI build failures.
|
||||
|
||||
The Command line interface (CLI) output is tested by the
|
||||
`test_cli_options.sh` script. It is located inside of `tests/cli/` and operates
|
||||
on the subdirectories of that folder.
|
||||
|
||||
If a PR is altering the CLI output, files inside those directories might
|
||||
need to be manually updated. This often happens when options are
|
||||
added, removed or altered. Keep in mind that the version string line
|
||||
(example: `# Uncrustify-0.69.0_f`) of outputs from commands like
|
||||
`--show-config` should be replaced with a blank line.
|
||||
|
||||
### Debugging
|
||||
|
||||
The first method is to use uncrustify itself to get debug informations.
|
||||
Using:
|
||||
```.txt
|
||||
uncrustify -c myExample.cfg -f myExample.cpp -p myExample.p -L A 2>myExample.A
|
||||
```
|
||||
you get two files for the first informations.
|
||||
The p-file gives you details of the parsing process and indentation.
|
||||
```.txt
|
||||
# Line Tag Parent Columns Br/Lvl/pp Flag Nl Text
|
||||
# 1> CLASS[ NONE][ 1/ 1/ 6/ 0][0/0/0][ 10070000][0-0] class
|
||||
# 1> TYPE[ CLASS][ 7/ 7/ 14/ 1][0/0/0][ 10000000][0-0] Capteur
|
||||
# 1> BRACE_OPEN[ CLASS][ 15/ 15/ 16/ 1][0/0/0][ 100000400][0-0] {
|
||||
```
|
||||
|
||||
The A-file gives you many details about the run itself, where the process is running thru,
|
||||
which values have the most important variables.
|
||||
```.txt
|
||||
tokenize(2351): orig_line is 1, orig_col is 1, text() 'class', type is CLASS, orig_col_end is 6
|
||||
tokenize(2351): orig_line is 1, orig_col is 7, text() 'Capteur', type is WORD, orig_col_end is 14
|
||||
tokenize(2351): orig_line is 1, orig_col is 15, text() '{', type is BRACE_OPEN, orig_col_end is 16
|
||||
```
|
||||
|
||||
It might be usefull to add some code lines to see where something is happening.
|
||||
Use the package `unc_tools`.
|
||||
Remove the comment at line:
|
||||
```.cpp
|
||||
#define DEVELOP_ONLY
|
||||
```
|
||||
Import the package:
|
||||
```.cpp
|
||||
#include "unc_tools.h"
|
||||
```
|
||||
Add at some places the line:
|
||||
```.cpp
|
||||
prot_the_line(__LINE__, 6, 0);
|
||||
```
|
||||
Compile again with DEBUG option.
|
||||
|
||||
|
||||
|
||||
### How to add an option
|
||||
|
||||
If you need a new option, there are a few steps to follow.
|
||||
Take as example the option `sp_trailing_ret_t`
|
||||
|
||||
First define the option:
|
||||
- Insert the code below to the file src/options.h
|
||||
_NOTE:
|
||||
This file is processed by make_options.py, and must conform to a particular
|
||||
format. Option groups are marked by '//begin ' (in upper case; this example
|
||||
is lower case to prevent being considered a region marker for code folding)
|
||||
followed by the group description. Options consist of two lines of
|
||||
declaration preceded by one or more lines of C++ comments. The comments form
|
||||
the option description and are taken verbatim, aside from stripping the
|
||||
leading '// '. Only comments immediately preceding an option declaration,
|
||||
with no blank lines, are taken as part of the description, so a blank line
|
||||
may be used to separate notations from a description.
|
||||
An option declaration is 'extern TYPE\nNAME;', optionally followed by
|
||||
' // = VALUE' if the option has a default value that is different from the
|
||||
default-constructed value type of the option. The 'VALUE' must be valid C++
|
||||
code, and is taken verbatim as an argument when creating the option's
|
||||
instantiation. Note also that the line break, as shown, is required.
|
||||
_
|
||||
```.cpp
|
||||
// Add or remove space around trailing return operator '->'.
|
||||
extern Option<iarf_e>
|
||||
sp_trailing_ret_t;
|
||||
```
|
||||
- Insert the code below to the file src/space.cpp
|
||||