Skip to content

Commit fbb8c89

Browse files
authored
Merge pull request #3183 from masatake/no-pcre2-warning
main: give warning when pcre2 is not linked
2 parents a1032d2 + 78f924b commit fbb8c89

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

main/lregex.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,17 @@ static regexPattern *addCompiledCallbackPattern (struct lregexControlBlock *lcb,
13561356
return ptrn;
13571357
}
13581358

1359+
#ifndef HAVE_PCRE2
1360+
static void no_pcre2_regex_flag_short (char c, void* data)
1361+
{
1362+
error (WARNING, "'p' flag is specied but pcre2 regex engine is not linked.");
1363+
}
1364+
static void no_pcre2_regex_flag_long (const char* const s, const char* const unused CTAGS_ATTR_UNUSED, void* data)
1365+
{
1366+
error (WARNING, "{pcre2} flag is specied but pcre2 regex engine is not linked.");
1367+
}
1368+
#endif
1369+
13591370
static flagDefinition backendFlagDefs[] = {
13601371
{ 'b', "basic", basic_regex_flag_short, basic_regex_flag_long,
13611372
NULL, "interpreted as a Posix basic regular expression."},
@@ -1364,6 +1375,9 @@ static flagDefinition backendFlagDefs[] = {
13641375
#ifdef HAVE_PCRE2
13651376
{ 'p', "pcre2", pcre2_regex_flag_short, pcre2_regex_flag_long,
13661377
NULL, "use pcre2 regex engine"},
1378+
#else
1379+
{ 'p', "pcre2", no_pcre2_regex_flag_short, no_pcre2_regex_flag_long,
1380+
NULL, "pcre2 is NOT linked!"},
13671381
#endif
13681382
};
13691383

main/options.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,24 +2907,24 @@ static parametricOption ParametricOptions [] = {
29072907

29082908
static booleanOption BooleanOptions [] = {
29092909
{ "append", &Option.append, true, STAGE_ANY },
2910-
{ "file-scope", ((bool *)XTAG_FILE_SCOPE), false, STAGE_ANY, setBooleanToXtagWithWarning },
2911-
{ "file-tags", ((bool *)XTAG_FILE_NAMES), false, STAGE_ANY, setBooleanToXtagWithWarning },
2910+
{ "file-scope", ((bool *)XTAG_FILE_SCOPE), false, STAGE_ANY, setBooleanToXtagWithWarning },
2911+
{ "file-tags", ((bool *)XTAG_FILE_NAMES), false, STAGE_ANY, setBooleanToXtagWithWarning },
29122912
{ "filter", &Option.filter, true, STAGE_ANY },
29132913
{ "guess-language-eagerly", &Option.guessLanguageEagerly, false, STAGE_ANY },
29142914
{ "line-directives",&Option.lineDirectives, false, STAGE_ANY },
29152915
{ "links", &Option.followLinks, false, STAGE_ANY },
2916-
{ "machinable", &localOption.machinable, true, STAGE_ANY },
2916+
{ "machinable", &localOption.machinable, true, STAGE_ANY },
29172917
{ "put-field-prefix", &Option.putFieldPrefix, false, STAGE_ANY },
29182918
{ "print-language", &Option.printLanguage, true, STAGE_ANY },
29192919
{ "quiet", &Option.quiet, false, STAGE_ANY },
29202920
#ifdef RECURSE_SUPPORTED
29212921
{ "recurse", &Option.recurse, false, STAGE_ANY },
29222922
#endif
2923-
{ "verbose", &ctags_verbose, false, STAGE_ANY },
2923+
{ "verbose", &ctags_verbose, false, STAGE_ANY },
29242924
#ifdef WIN32
29252925
{ "use-slash-as-filename-separator", (bool *)&Option.useSlashAsFilenameSeparator, false, STAGE_ANY },
29262926
#endif
2927-
{ "with-list-header", &localOption.withListHeader, true, STAGE_ANY },
2927+
{ "with-list-header", &localOption.withListHeader, true, STAGE_ANY },
29282928
{ "_fatal-warnings",&Option.fatalWarnings, false, STAGE_ANY },
29292929
};
29302930

0 commit comments

Comments
 (0)