From 0af6d2e186b0ac5333da81a858055dd4468de326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= Date: Wed, 12 Apr 2023 11:04:45 +0200 Subject: [PATCH] Make isIncludeFile() return TRUE for files with an unknown extension --- main/options.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main/options.c b/main/options.c index 3f6f3d1d64..0440faa9b5 100644 --- a/main/options.c +++ b/main/options.c @@ -131,6 +131,12 @@ static const char *const HeaderExtensions [] = { "h", "H", "hh", "hpp", "hxx", "h++", "inc", "def", NULL }; +static const char *const SourceExtensions [] = { + "c", "c++", "cc", "cp", "cpp", "cxx", "C", "CPP", "CXX", NULL +}; + +static stringList* SourceExt; + long ctags_debugLevel = 0L; bool ctags_verbose = false; @@ -1142,7 +1148,9 @@ extern bool isIncludeFile (const char *const fileName) const char *const extension = fileExtension (fileName); if (Option.headerExt != NULL) result = stringListExtensionMatched (Option.headerExt, extension); - return result; + if (result) + return true; + return !stringListExtensionMatched (SourceExt, extension); } /* @@ -3856,6 +3864,7 @@ extern void initOptions (void) verbose ("Setting option defaults\n"); installHeaderListDefaults (); + SourceExt = stringListNewFromArgv (SourceExtensions); verbose (" Installing default language mappings:\n"); installLanguageMapDefaults (); verbose (" Installing default language aliases:\n"); @@ -3935,6 +3944,7 @@ extern void freeOptionResources (void) freeList (&Excluded); freeList (&ExcludedException); freeList (&Option.headerExt); + freeList (&SourceExt); freeList (&Option.etagsInclude); freeSearchPathList (&OptlibPathList);