Skip to content

Commit f5fd1b6

Browse files
authored
Merge pull request #94 from matejak/no_warnings
Get rid of include warnings
2 parents 894dadb + 9c23631 commit f5fd1b6

17 files changed

+50
-38
lines changed

bin/argbash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ parse_commandline()
156156
_next="${_key##-c}"
157157
if test -n "$_next" -a "$_next" != "$_key"
158158
then
159-
begins_with_short_option "$_next" && shift && set -- "-c" "-${_next}" "$@" || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
159+
{ begins_with_short_option "$_next" && shift && set -- "-c" "-${_next}" "$@"; } || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
160160
fi
161161
;;
162162
-I|--search)

bin/argbash-init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ parse_commandline()
9898
_next="${_key##-s}"
9999
if test -n "$_next" -a "$_next" != "$_key"
100100
then
101-
begins_with_short_option "$_next" && shift && set -- "-s" "-${_next}" "$@" || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
101+
{ begins_with_short_option "$_next" && shift && set -- "-s" "-${_next}" "$@"; } || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
102102
fi
103103
;;
104104
--no-hints|--hints)

src/argbash-lib.m4

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
m4_define([INCLUDE_ACCORDING_TO_OUTPUT_TYPE],
2-
[m4_include([output-$1.m4])])
2+
[m4_include_once([output-$1.m4])])
33

44
m4_ifndef([_OUTPUT_TYPE],
55
[m4_define([_OUTPUT_TYPE], [bash-script])])
66

77

8-
m4_include([list.m4])
9-
m4_include([constants.m4])
108
m4_include([utilities.m4])
11-
m4_include([collectors.m4])
12-
m4_include([stuff.m4])
13-
m4_include([default_settings.m4])
9+
m4_include_once([list.m4])
10+
m4_include_once([constants.m4])
11+
m4_include_once([collectors.m4])
12+
m4_include_once([stuff.m4])
13+
m4_include_once([default_settings.m4])
1414
INCLUDE_ACCORDING_TO_OUTPUT_TYPE(_OUTPUT_TYPE)
1515

1616
dnl These macros that are being undefined are not needed and they present a security threat when exposed during Argbash run

src/output-bash-script.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
m4_include([function_generators.m4])
2-
m4_include([argument_value_types.m4])
3-
m4_include([env_vars.m4])
4-
m4_include([progs.m4])
5-
m4_include([value_validators.m4])
1+
m4_include_once([function_generators.m4])
2+
m4_include_once([argument_value_types.m4])
3+
m4_include_once([env_vars.m4])
4+
m4_include_once([progs.m4])
5+
m4_include_once([value_validators.m4])
66

77

88
m4_define([_MAKE_DEFAULTS_TO_ALL_POSITIONAL_ARGUMENTS], [[no]])

src/output-completion.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl TODO: Basename determination: output filename, or input filename, or nothing.
2-
m4_include([argument_value_types.m4])
3-
m4_include([value_validators.m4])
2+
m4_include_once([argument_value_types.m4])
3+
m4_include_once([value_validators.m4])
44

55
dnl Make somehow sure that the program name is translated to a valid shell function identifier
66
m4_define([_TRANSLATE_BAD_CHARS], [m4_translit([[$1]], [-.], [__])])

src/output-docopt.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
m4_include([docopt.m4])
1+
m4_include_once([docopt.m4])
22

33

44
dnl

src/output-manpage-defs.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
m4_include([docopt.m4])
1+
m4_include_once([docopt.m4])
22

33
dnl
44
dnl $1: The macro call (the caller is supposed to pass [$0($@)])

src/output-manpage.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
m4_include([docopt.m4])
1+
m4_include_once([docopt.m4])
22

33
dnl
44
dnl $1: The macro call (the caller is supposed to pass [$0($@)])

src/output-posix-script.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
m4_include([function_generators.m4])
2-
m4_include([argument_value_types.m4])
3-
m4_include([env_vars.m4])
4-
m4_include([progs.m4])
5-
m4_include([value_validators.m4])
1+
m4_include_once([function_generators.m4])
2+
m4_include_once([argument_value_types.m4])
3+
m4_include_once([env_vars.m4])
4+
m4_include_once([progs.m4])
5+
m4_include_once([value_validators.m4])
66

77

88
dnl TODO: Can't do:

src/utilities.m4

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
m4_include([list.m4])
1+
2+
m4_set_delete([__FILES_ALREADY_INCLUDED__])
3+
m4_set_add([__FILES_ALREADY_INCLUDED__], __file__)
4+
dnl
5+
dnl $1: The filename to include
6+
m4_define([m4_include_once], [m4_do(
7+
[m4_set_contains([__FILES_ALREADY_INCLUDED__], [$1], [],
8+
[m4_set_add([__FILES_ALREADY_INCLUDED__], [$1])m4_include([$1])])],
9+
)])
10+
11+
12+
m4_include_once([list.m4])
213

314

415
m4_define([_ENDL_],

src/value_validators.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
m4_include([function_generators.m4])
1+
m4_include_once([function_generators.m4])
22

33
dnl
44
dnl Define a validator for a particular type. Instead of using m4_define, use this:

tests/unittests/check-arguments.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
m4_include([argbash-lib.m4])
2-
m4_include([test-support.m4])
1+
m4_include([utilities.m4])
2+
m4_include_once([argbash-lib.m4])
3+
m4_include_once([test-support.m4])
34

45
dnl TODO PROBLEMS:
56
dnl - defaults are quoted.

tests/unittests/check-env.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
m4_include([argbash-lib.m4])
2-
m4_include([test-support.m4])
1+
m4_include([utilities.m4])
2+
m4_include_once([argbash-lib.m4])
3+
m4_include_once([test-support.m4])
34

45
ARG_USE_ENV([OS_CLOUD], , [my blah help text])
56
ARG_USE_ENV([BOMB], [default BOMB], [a, BOMB])

tests/unittests/check-indentation.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
m4_include([list.m4])
21
m4_include([utilities.m4])
3-
m4_include([argument_value_types.m4])
4-
m4_include([test-support.m4])
2+
m4_include_once([list.m4])
3+
m4_include_once([argument_value_types.m4])
4+
m4_include_once([test-support.m4])
55

66
_SET_INDENT([x-])
77
assert_equals(_INDENT_(0)y, y)

tests/unittests/check-list.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
m4_include([list.m4])
2-
m4_include([test-support.m4])
1+
m4_include([utilities.m4])
2+
m4_include_once([test-support.m4])
33

44
dnl If BOMB gets expanded, we will be noticed.
55
assert_equals(m4_quote(m4_list_contents([lol])), [])

tests/unittests/check-types.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
m4_include([utilities.m4])
2-
m4_include([test-support.m4])
2+
m4_include_once([test-support.m4])
33

44
m4_define([CHECK], _CHECK_PASSED_ARGS_COUNT(2, 3, [[one], [two (opt.)]]))
55

tests/unittests/check-utils.m4

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
m4_include([list.m4])
21
m4_include([utilities.m4])
3-
m4_include([function_generators.m4])
4-
m4_include([test-support.m4])
2+
m4_include_once([function_generators.m4])
3+
m4_include_once([test-support.m4])
54

65
m4_list_append([FOO], [one])
76
m4_list_append([FOO], [two])

0 commit comments

Comments
 (0)