Summary: | flag-o-matic.eclass: test-flags-* docs do not describe output | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sam James <sam> |
Component: | Eclasses | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | gentoo |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Sam James
![]() ![]() ![]() ![]() Functions in BASH can only RETURN number (integer), not string, but they can OUTPUT string. Descriptions of test-flags-CC etc. are correct and they mean that it is possible to use these functions in this way: if test-flags-CC -flag1 -flag2; then .... else .... fi There are test-flag-* and test-flags-* variants of these functions. test-flag-* can be actually called with multiple arguments. test-flag-* returns true only if all specified flags are supported, and currently does not output anything. test-flags-* returns true if at least one of specified flags is supported, and outputs only these flags which are supported (some subset of flags passed to function). If current behavior is to remain, then descriptions of test-flags-*, but not test-flag-*, can be extended: # @FUNCTION: test-flags-CC # @USAGE: <flags> # @DESCRIPTION: # Returns shell true if <flags> are supported by the C compiler, else returns shell false. # Outputs supported flags. I know. Let me rephrase: "people may be relying on undocumented behaviour of functions". use() has verbose usev() equivalent. Maybe it would be cleaner to have 4 groups of functions. E.g.: test-flags-all-* (e.g. test-flags-all-CC) test-flags-verbose-all-* (e.g. test-flags-verbose-all-CC) test-flags-any-* (e.g. test-flags-any-CC) test-flags-verbose-any-* (e.g. test-flags-verbose-any-CC) |