summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--addon/CMakeLists.txt4
-rw-r--r--addon/doxmlparser/examples/metrics/CMakeLists.txt2
-rw-r--r--addon/doxmlparser/test/CMakeLists.txt1
-rw-r--r--addon/doxyapp/CMakeLists.txt1
-rw-r--r--addon/doxyparse/CMakeLists.txt1
-rw-r--r--addon/doxysearch/CMakeLists.txt1
-rw-r--r--cmake/CompilerWarnings.cmake4
-rw-r--r--cmake/Coverage.cmake39
-rw-r--r--cmake/SearchReplace.cmake4
-rw-r--r--cmake/git_watcher.cmake13
-rw-r--r--src/CMakeLists.txt33
-rw-r--r--src/constexp.l2
-rw-r--r--src/htmlentity.cpp4
-rw-r--r--src/memberdef.cpp11
-rw-r--r--src/pyscanner.l4
-rw-r--r--src/util.cpp1
17 files changed, 110 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20c87dc..16c0454 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,7 @@ option(use_libclang "Add support for libclang parsing." OFF)
option(win_static "Link with /MT in stead of /MD on windows" OFF)
option(english_only "Only compile in support for the English language" OFF)
option(force_qt4 "Forces doxywizard to build using Qt4 even if Qt5 is installed" OFF)
+option(enable_coverage "Enable coverage reporting for gcc/clang [development]" OFF)
SET(enlarge_lex_buffers "262144" CACHE INTERNAL "Sets the lex input and read buffers to the specified size")
@@ -159,6 +160,7 @@ if (win_static)
endif()
include(cmake/CompilerWarnings.cmake)
+include(cmake/Coverage.cmake)
add_subdirectory(libmd5)
add_subdirectory(liblodepng)
diff --git a/addon/CMakeLists.txt b/addon/CMakeLists.txt
index fd8c73f..ec4706b 100644
--- a/addon/CMakeLists.txt
+++ b/addon/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_subdirectory(doxmlparser)
+if (build_xmlparser)
+ add_subdirectory(doxmlparser)
+endif ()
if (build_app)
add_subdirectory(doxyapp)
diff --git a/addon/doxmlparser/examples/metrics/CMakeLists.txt b/addon/doxmlparser/examples/metrics/CMakeLists.txt
index 8e03246..255ae0e 100644
--- a/addon/doxmlparser/examples/metrics/CMakeLists.txt
+++ b/addon/doxmlparser/examples/metrics/CMakeLists.txt
@@ -11,4 +11,6 @@ main.cpp
target_link_libraries(doxmlparser_metrics
doxmlparser
qtools
+ ${COVERAGE_LINKER_FLAGS}
)
+
diff --git a/addon/doxmlparser/test/CMakeLists.txt b/addon/doxmlparser/test/CMakeLists.txt
index c38c8a5..2d92b72 100644
--- a/addon/doxmlparser/test/CMakeLists.txt
+++ b/addon/doxmlparser/test/CMakeLists.txt
@@ -12,4 +12,5 @@ main.cpp
target_link_libraries(doxmlparser_test
doxmlparser
qtools
+ ${COVERAGE_LINKER_FLAGS}
)
diff --git a/addon/doxyapp/CMakeLists.txt b/addon/doxyapp/CMakeLists.txt
index af4590d..9d74fbc 100644
--- a/addon/doxyapp/CMakeLists.txt
+++ b/addon/doxyapp/CMakeLists.txt
@@ -31,6 +31,7 @@ ${CMAKE_THREAD_LIBS_INIT}
${SQLITE3_LIBRARIES}
${EXTRA_LIBS}
${CLANG_LIBS}
+${COVERAGE_LINKER_FLAGS}
)
install(TARGETS doxyapp DESTINATION bin)
diff --git a/addon/doxyparse/CMakeLists.txt b/addon/doxyparse/CMakeLists.txt
index d2a8f63..8e0ad49 100644
--- a/addon/doxyparse/CMakeLists.txt
+++ b/addon/doxyparse/CMakeLists.txt
@@ -31,6 +31,7 @@ ${CMAKE_THREAD_LIBS_INIT}
${SQLITE3_LIBRARIES}
${EXTRA_LIBS}
${CLANG_LIBS}
+${COVERAGE_LINKER_FLAGS}
)
install(TARGETS doxyparse DESTINATION bin)
diff --git a/addon/doxysearch/CMakeLists.txt b/addon/doxysearch/CMakeLists.txt
index 54794a6..7a1e1c1 100644
--- a/addon/doxysearch/CMakeLists.txt
+++ b/addon/doxysearch/CMakeLists.txt
@@ -17,6 +17,7 @@ target_link_libraries(doxyindexer
${XAPIAN_LIBRARIES}
${ZLIB_LIBRARIES}
${WIN_EXTRA_LIBS}
+ ${COVERAGE_LINKER_FLAGS}
qtools
)
diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake
index e6c1539..8137f6f 100644
--- a/cmake/CompilerWarnings.cmake
+++ b/cmake/CompilerWarnings.cmake
@@ -100,9 +100,9 @@ function(set_project_warnings project_name)
if(MSVC)
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # e.g. Clang or AppleClang
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
- else()
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0")
set(GCC_EXTRA_WARNINGS
-Wno-implicit-fallthrough
diff --git a/cmake/Coverage.cmake b/cmake/Coverage.cmake
new file mode 100644
index 0000000..31f8341
--- /dev/null
+++ b/cmake/Coverage.cmake
@@ -0,0 +1,39 @@
+if(enable_coverage)
+ FIND_PROGRAM( LCOV_PATH lcov )
+ FIND_PROGRAM( GENHTML_PATH genhtml )
+ set(COVERAGE_COMPILER_FLAGS -g --coverage -O0
+ CACHE INTERNAL "")
+ set(COVERAGE_LINKER_FLAGS --coverage
+ CACHE INTERNAL "")
+ add_custom_target(coverage-clean
+ COMMAND ${LCOV_PATH} --rc lcov_branch_coverage=1 --directory . --zerocounters
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+ add_custom_target(coverage
+ COMMAND ${LCOV_PATH} --rc lcov_branch_coverage=1 --directory . --capture --output-file cov.info
+ COMMAND ${LCOV_PATH} --rc lcov_branch_coverage=1 --remove cov.info '*/c++/*' '*/_ctype.h' '*/generated_src/*' --output-file cov.info.cleaned
+ COMMAND ${CMAKE_COMMAND} -Dsearch=${CMAKE_BINARY_DIR}
+ -Dreplace=${CMAKE_SOURCE_DIR}
+ -Dsrc=cov.info.cleaned
+ -Ddst=cov.info.final
+ -P ${CMAKE_SOURCE_DIR}/cmake/SearchReplace.cmake
+ COMMAND ${GENHTML_PATH} --rc genhtml_branch_coverage=1
+ --function-coverage --branch-coverage
+ --title "Doxygen Coverage Report" --num-spaces 2
+ --legend --prefix ${CMAKE_SOURCE_DIR} --demangle-cpp
+ --output-directory cov_output cov.info.final
+ COMMAND ${CMAKE_COMMAND} -E remove cov.info cov.info.cleaned cov.info.final
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+ add_custom_command(TARGET coverage POST_BUILD
+ COMMAND ;
+ COMMENT "Open ./cov_output/index.html in your browser to view the coverage report"
+ )
+endif()
+
+function(set_project_coverage project_name)
+ if(enable_coverage)
+ target_compile_options(${project_name} PRIVATE ${COVERAGE_COMPILER_FLAGS})
+ endif()
+endfunction()
+
diff --git a/cmake/SearchReplace.cmake b/cmake/SearchReplace.cmake
new file mode 100644
index 0000000..116cd71
--- /dev/null
+++ b/cmake/SearchReplace.cmake
@@ -0,0 +1,4 @@
+message("Replacing ${search} by ${replace} in file ${src} and writing to ${dst}...")
+file(READ ${src} file_contents)
+string(REPLACE "${search}" "${replace}" file_contents ${file_contents})
+file(WRITE ${dst} ${file_contents})
diff --git a/cmake/git_watcher.cmake b/cmake/git_watcher.cmake
index 72b7852..ac34c1d 100644
--- a/cmake/git_watcher.cmake
+++ b/cmake/git_watcher.cmake
@@ -150,6 +150,19 @@ function(CheckGit _working_dir _state_changed _state)
# (Passing by reference in CMake is awkward...)
set(${_state} ${state} PARENT_SCOPE)
+ if(EXISTS "${POST_CONFIGURE_GIT_VERSION_FILE}")
+ if("${PRE_CONFIGURE_GIT_VERSION_FILE}" IS_NEWER_THAN "${POST_CONFIGURE_GIT_VERSION_FILE}")
+ file(REMOVE "${POST_CONFIGURE_GIT_VERSION_FILE}")
+ file(REMOVE "${GIT_STATE_FILE}")
+ set(${_state_changed} "true" PARENT_SCOPE)
+ return()
+ endif()
+ else()
+ file(REMOVE "${GIT_STATE_FILE}")
+ set(${_state_changed} "true" PARENT_SCOPE)
+ return()
+ endif()
+
# Check if the state has changed compared to the backup on disk.
if(EXISTS "${GIT_STATE_FILE}")
file(READ "${GIT_STATE_FILE}" OLD_HEAD_CONTENTS)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 255db79..598f73c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -128,12 +128,30 @@ foreach(lex_file ${LEX_FILES})
OUTPUT ${GENERATED_SRC}/${lex_file}.l.h
)
set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1)
+ # for code coverage we need the flex sources in the build src directory
+ add_custom_command(
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/${lex_file}.l ${CMAKE_BINARY_DIR}/src/${lex_file}.l
+ DEPENDS ${CMAKE_SOURCE_DIR}/src/${lex_file}.l
+ OUTPUT ${CMAKE_BINARY_DIR}/src/${lex_file}.l
+ )
- FLEX_TARGET(${lex_file} ${lex_file}.l ${GENERATED_SRC}/${lex_file}.cpp COMPILE_FLAGS "${LEX_FLAGS}")
+ FLEX_TARGET(${lex_file}
+ ${lex_file}.l
+ ${GENERATED_SRC}/${lex_file}.cpp
+ COMPILE_FLAGS "${LEX_FLAGS}")
endforeach()
-BISON_TARGET(constexp constexp.y ${GENERATED_SRC}/ce_parse.cpp COMPILE_FLAGS "${YACC_FLAGS}")
+BISON_TARGET(constexp
+ constexp.y
+ ${GENERATED_SRC}/ce_parse.cpp
+ COMPILE_FLAGS "${YACC_FLAGS}")
+
+add_custom_command(
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/constexp.y ${CMAKE_BINARY_DIR}/src
+ DEPENDS ${CMAKE_SOURCE_DIR}/src/constexp.y
+ OUTPUT ${CMAKE_BINARY_DIR}/src/constexp.y
+)
add_library(doxycfg STATIC
${GENERATED_SRC}/lang_cfg.h
@@ -290,8 +308,9 @@ endif()
##add_library(doxymain STATIC ${GENERATED_SRC}/${lex_file}.l.h)
##endforeach()
-add_executable(doxygen main.cpp)
-
+add_executable(doxygen
+ main.cpp
+)
if (use_libclang)
find_package(LLVM REQUIRED CONFIG)
@@ -327,6 +346,7 @@ target_link_libraries(doxygen
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBS}
${CLANG_LIBS}
+ ${COVERAGE_LINKER_FLAGS}
${DOXYGEN_EXTRA_LINK_OPTIONS}
)
@@ -334,5 +354,10 @@ set_project_warnings(doxycfg)
set_project_warnings(doxymain)
set_project_warnings(doxygen)
+set_project_coverage(qtools)
+set_project_coverage(doxycfg)
+set_project_coverage(doxymain)
+set_project_coverage(doxygen)
+
install(TARGETS doxygen DESTINATION bin)
diff --git a/src/constexp.l b/src/constexp.l
index a14f8d3..0f053bd 100644
--- a/src/constexp.l
+++ b/src/constexp.l
@@ -137,7 +137,7 @@ bool ConstExpressionParser::parse(const char *fileName,int lineNr,const QCString
struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
#ifdef FLEX_DEBUG
- yyset_debug(1,yyscanner);
+ constexpYYset_debug(1,p->yyscanner);
#endif
yyextra->constExpFileName = fileName;
diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp
index 543f86b..ae2d8f1 100644
--- a/src/htmlentity.cpp
+++ b/src/htmlentity.cpp
@@ -263,7 +263,7 @@ static struct htmlEntityInfo
{ SYM(clubs), "\xe2\x99\xa3", "&clubs;", "<clubs/>", "&#9827;", "{$\\clubsuit$}", NULL, "\\u9827?", { NULL, DocSymbol::Perl_unknown }},
{ SYM(hearts), "\xe2\x99\xa5", "&hearts;", "<hearts/>", "&#9829;", "{$\\heartsuit$}", NULL, "\\u9829?", { NULL, DocSymbol::Perl_unknown }},
{ SYM(diams), "\xe2\x99\xa6", "&diams;", "<diams/>", "&#9830;", "{$\\diamondsuit$}", NULL, "\\u9830?", { NULL, DocSymbol::Perl_unknown }},
- { SYM(quot), "\"", "&quot;", "\"", "&quot;", "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }},
+ { SYM(quot), "\"", "&quot;", "\"", "&quot;", "\"{}", "\"", "\"", { "\"", DocSymbol::Perl_char }},
{ SYM(amp), "&", "&amp;", "&amp;", "&amp;", "\\&", "&", "&", { "&", DocSymbol::Perl_char }},
{ SYM(lt), "<", "&lt;", "&lt;", "&lt;", "<", "<", "<", { "<", DocSymbol::Perl_char }},
{ SYM(gt), ">", "&gt;", "&gt;", "&gt;", ">", ">", ">", { ">", DocSymbol::Perl_char }},
@@ -311,7 +311,7 @@ static struct htmlEntityInfo
{ SYM(DoubleColon), "::", "::", "::", "::", "::", "::", "::", { "::", DocSymbol::Perl_string }},
{ SYM(Percent), "%", "%", "%", "%", "\\%", "%", "%", { "%", DocSymbol::Perl_char }},
{ SYM(Pipe), "|", "|", "|", "|", "$|$", "|", "|", { "|", DocSymbol::Perl_char }},
- { SYM(Quot), "\"", "\"", "\"", "&quot;", "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }},
+ { SYM(Quot), "\"", "\"", "\"", "&quot;", "\"{}", "\"", "\"", { "\"", DocSymbol::Perl_char }},
{ SYM(Minus), "-", "-", "-", "-", "-\\/", "-", "-", { "-", DocSymbol::Perl_char }},
{ SYM(Plus), "+", "+", "+", "+", "+", "+", "+", { "+", DocSymbol::Perl_char }},
{ SYM(Dot), ".", ".", ".", ".", ".", ".", ".", { ".", DocSymbol::Perl_char }},
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index ac7605d..d857fa6 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -4008,16 +4008,13 @@ void MemberDefImpl::warnIfUndocumented() const
const FileDef *fd = getFileDef();
const GroupDef *gd = getGroupDef();
const Definition *d=0;
- const char *t=0;
+ QCString t;
if (cd)
- t="class", d=cd;
+ t=cd->compoundTypeString(), d=cd;
else if (nd)
{
d=nd;
- if (d->getLanguage() == SrcLangExt_Fortran)
- t="module";
- else
- t="namespace";
+ t=nd->compoundTypeString();
}
else if (gd)
t="group", d=gd;
@@ -4036,7 +4033,7 @@ void MemberDefImpl::warnIfUndocumented() const
)
{
warn_undoc(getDefFileName(),getDefLine(),"Member %s%s (%s) of %s %s is not documented.",
- qPrint(name()),qPrint(argsString()),qPrint(memberTypeName()),t,qPrint(d->name()));
+ qPrint(name()),qPrint(argsString()),qPrint(memberTypeName()),qPrint(t),qPrint(d->name()));
}
else if (!isDetailedSectionLinkable())
{
diff --git a/src/pyscanner.l b/src/pyscanner.l
index f2a315c..ed76c75 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -1618,6 +1618,10 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
// TODO: Fix me
yyextra->docBlockInBody=FALSE;
+ if (!yyextra->current->doc.isEmpty())
+ {
+ yyextra->current->doc=yyextra->current->doc.stripWhiteSpace()+"\n\n";
+ }
if (yyextra->docBlockInBody && yyextra->previous && !yyextra->previous->doc.isEmpty())
{
yyextra->previous->doc=yyextra->previous->doc.stripWhiteSpace()+"\n\n";
diff --git a/src/util.cpp b/src/util.cpp
index 5b799c8..d198a5d 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6199,6 +6199,7 @@ void filterLatexString(FTextStream &t,const char *str,
case '%': t << "\\%"; break;
case '#': t << "\\#"; break;
case '$': t << "\\$"; break;
+ case '"': t << "\"{}"; break;
case '-': t << "-\\/"; break;
case '^': (usedTableLevels()>0) ? t << "\\string^" : t << (char)c; break;
case '~': t << "\\string~"; break;