Commit Graph

11480 Commits

Author SHA1 Message Date
ridiculousfish
a59f35a378 Make block_type_t an enum class 2019-12-22 15:37:14 -08:00
ridiculousfish
4529e7d183 Reverse the order of the block stack
Previously, the block stack was a true stack. However in most cases, you
want to traverse the stack from the topmost frame down. This is awkward
to do with range-based for loops.

Switch it to pushing new blocks to the front of the block list.
This simplifies some traversals.
2019-12-22 15:07:41 -08:00
ridiculousfish
82baf74785 Attempt to fix the build
Move the CMake changes down in the file after the FIND_PACKAGE calls.
2019-12-22 12:31:14 -08:00
ridiculousfish
87854c81f5 Allow C++ standard to be passed to CHECK_CXX_SOURCE_COMPILES
Work around the issue in CMake where C++ standard doesn't get propagated
to CHECK_CXX_SOURCE_COMPILES. Also correctly check for std::make_unique;
the define was missing from the config.h header.
2019-12-22 12:07:46 -08:00
ridiculousfish
10ac83ae32 lru to use std::map, not std::unordered_map
We depend on pointer stability here and it just seems easier
to think about it with std::map.
2019-12-21 17:09:21 -08:00
Sergei Morozov
624e76ae89 Added the --cleanup option completion for the git commit command 2019-12-21 20:03:54 +01:00
David Adam
45633f4a54 cmake: force C++11 in CHECK_CXX_SOURCE_COMPILES for atomic
GCC 4.8 requires the use of `-std=gnu++11` or similar to enable atomic
features. However, older versions of CMake don't pick up the
project-wide target for C++11 when building the configure check targets.
Although CMake policy 0067 could be set to NEW to enable this, it only
exists on CMake 3.8 and newer, while many of our supported platforms are
on an older version.
2019-12-21 22:00:22 +08:00
Johannes Altmanninger
6dd9e50f82 time: complete external time options only if available 2019-12-21 11:56:06 +01:00
Fabian Homborg
f0df211f4c Solve remaining conflicts sv.po
Sorry!
2019-12-21 11:12:17 +01:00
Jason
126e37ab26 Remove all fuzzy translations (see also #6418) 2019-12-21 10:21:45 +01:00
Jason
28d812f543 Restore last good version of Swedish translations (08ff39c) 2019-12-21 10:21:39 +01:00
Jason
616ff28dea Remove all fuzzy translations 2019-12-21 10:17:12 +01:00
Dan Martinez
de37e52dca Mention how functions --details handles aliases (#6423)
* Mention how `functions --details` handles aliases

* Clarify that `source` is responsible for `-` paths
2019-12-21 09:59:14 +01:00
ridiculousfish
2e7cbaeaba Remove io_file_t::is_dev_null
This is no longer used.
2019-12-20 14:47:54 -08:00
ridiculousfish
97dd5ece26 Remove redirection_is_to_real_file
This was previously required so that, if there was a redirection to a
file, we would fork a process to create the file even if there was no
output. For example `echo -n >/tmp/file.txt` would have to create
file.txt even though it would be empty.

However now we open the file before fork, so we no longer need special
logic around this.
2019-12-20 14:40:57 -08:00
Fabian Homborg
17b499d2ea docs/printf: Don't double "%"
This might be a leftover from doxygen, but sphinx does *not* require
"%%" here to print "%", so it shows

    %%d

instead of the correct

    %d

[ci skip]
2019-12-20 17:13:21 +01:00
Fabian Homborg
dcf8b0e3aa Add test for time 2019-12-20 17:13:21 +01:00
David Adam
8f2f3b648f cmake: check for 64-bit atomic operations directly
780bac671f did not actually successfully
compile on any platforms, leading to -latomic always being added
(including on platforms it does not exist on).

Work on #5865.
2019-12-20 23:47:46 +08:00
David Adam
780bac671f cmake: add -latomic on platforms that need it for 64-bit atomic operations
Closes #5865.
2019-12-20 23:00:06 +08:00
Johannes Altmanninger
3274dbacf4 Fix autosuggestions for time 2019-12-20 09:21:17 +01:00
Mahmoud Al-Qudsi
664d6fb132 Convert time to a job decorator 2019-12-19 23:02:23 -06:00
Mahmoud Al-Qudsi
ca18d88138 Switch to C++11 chrono's steady_clock for portability reasons
`clock_gettime()` is apparently not readily available on many fairly
recent *nix systems.

Closes #6440
2019-12-19 21:26:46 -06:00
Johannes Altmanninger
feb87bbda8 __fish_man_page: ignore prefixing variable assignments 2019-12-19 23:44:58 +01:00
Johannes Altmanninger
1410f938aa read: discard IFS delimiters before the last token
Do this only when splitting on IFS characters which usually contains
whitespace characters --- read --delimiter is unchanged; it still
consumes no more than one delimiter per variable. This seems better,
because it allows arbitrary delimiters in the last field.

Fixes #6406
2019-12-19 23:44:58 +01:00
ridiculousfish
0531c02ce4 Remove 'user_supplied' flag for io_fd_t
user_supplied was used to distinguish IO redirections which were
explicit, vs those that came about through "transmogrphication." But
transmogrification is no more. Remove the flag.
2019-12-19 14:14:23 -08:00
Fabian Homborg
22b2dbd97d functions/history: X is incompatible with SDMV, not C
"-C" is short for "--case-sensitive", which is entirely okay with "--delete".

The one that isn't okay is "-X", which is short for "--Clear".

Seen on gitter.im
2019-12-19 20:59:17 +01:00
Mahmoud Al-Qudsi
ec11bd4af7 [make] add default all in addition to catch-all % 2019-12-18 22:13:41 -06:00
Mahmoud Al-Qudsi
2a14199421 Replace pseudo all target with catch-all %
This should fix the CI broken in-tree builds.
2019-12-18 22:11:02 -06:00
Mahmoud Al-Qudsi
abc2468c70 Add alternate patch to support in-tree CMake Makefile builds
This patch keeps the existing `make` shims via `GNUmakefile` and
`BSDmakefile` but also resolves the issue reported in #6264 with
CMake-generated `Makefile` overwriting the extant `Makefile` causing the
source directory to become dirty once again.

Closes #6264
2019-12-18 21:35:46 -06:00
Mahmoud Al-Qudsi
aeaf2f93e2 Revert "Remove Makefile(s)"
This reverts commit 326f5586de.

See discussion in #6264.
2019-12-18 21:27:09 -06:00
Rosen Penev
9936362599 common.cpp: Don't always include cxxabi.h
cxxabi.h is not available with LLVM's libcxx
2019-12-18 21:03:51 -06:00
Mahmoud Al-Qudsi
e5e66ac6d7 Merge branch 'time' 2019-12-18 21:00:00 -06:00
Mahmoud Al-Qudsi
103726767c [time] Convince GCC control flow does not reach end of function 2019-12-18 20:53:38 -06:00
Mahmoud Al-Qudsi
704a90deec Rename time unit enum to please gcc 2019-12-18 20:48:02 -06:00
Mahmoud Al-Qudsi
be37656067 Support time -v for detailed time output
This breaks down the usage into fish vs external processes.
2019-12-18 20:28:15 -06:00
Mahmoud Al-Qudsi
1ed5e7e478 Dynamically choose units for time output 2019-12-18 20:27:12 -06:00
Mahmoud Al-Qudsi
5956270015 Add time builtin that understands fish script and external executables
This now works:

```fish
function foo
    for n in (seq 1 100000)
        test $n -eq 42
    end
end

time foo
```
2019-12-18 20:27:08 -06:00
Mahmoud Al-Qudsi
364929e46e Disown first-run python completions generation
Closes #6269.
2019-12-18 14:12:49 -06:00
Jason
48bf3a4907 Delete __fish_sgrep.fish 2019-12-18 13:17:54 -06:00
Mahmoud Al-Qudsi
6dc8a1d3a7 Partially address #6340 (escape files starting with -)
This prefixes files beginning with `-` with a `./` when generating
completions *in fish code*. Standard completions for directory listings
generated by the C++ directory traversal code are not afected by this
patch.

Most fish completions defer to `__fish_complete_suffix` to generate the
file/directory completions, these *will* be corrected.
2019-12-18 13:13:23 -06:00
Mahmoud Al-Qudsi
92401d8ebb Fix unused return result hack to work on macOS/GCC 7.4+
As of GCC 7.4 (at least under macOS 10.10), the previous workaround of
casting a must-use result to `(void)` to avoid warnings about unused
code no longer works.

This workaround is uglier but it quiets these warnings.
2019-12-18 12:43:13 -06:00
Mahmoud Al-Qudsi
60670999ad Fix mismatched wchar_t sign comparison errors on some platforms
The C++ spec (as of C++17/n4713) does not specify the sign of `wchar_t`,
saying only (in section 6.7.1: Fundamental Types)

> Type wchar_t shall have the same size, signedness, and alignment
> requirements (6.6.5) as one of the other integral types, called its
> underlying type.

On most *nix platforms on AMD64 architecture, `wchar_t` is a signed type
and can be compared with `int32_t` without incident, but on at least
some platforms (tested: clang under FreeBSD 12.1 on AARCH64), `wchar_t`
appears to be unsigned leading to sign comparison warnings:

```
../src/widecharwidth/widechar_width.h:512:48: warning: comparison of
integers of different signs: 'const wchar_t' and 'int32_t' (aka 'int')
[-Wsign-compare]

    return where != std::end(arr) && where->lo <= c;
```

This patch forces the use of wchar_t for the range start/end values in
`widechar_range` and the associated comparison values.
2019-12-18 12:32:04 -06:00
Mahmoud Al-Qudsi
d90d4f849c Force symlink creation in realpath tests
If an earlier test was aborted, the symlink would still be present and
the subsequent run will fail to create the symlink as it wasn't forced.
2019-12-18 12:31:24 -06:00
ridiculousfish
e52433d6fe Fix gcc warnings harder 2019-12-17 19:51:00 -08:00
ridiculousfish
7ab373fbbd Fix some gcc warnings 2019-12-17 19:22:43 -08:00
ridiculousfish
311f47d683 Remove an errant fprintf from the tests 2019-12-17 18:26:57 -08:00
ridiculousfish
d4daa28690 Correctly set the exit status in block and function processes
Previously, if the user control-C'd out of a process, we would set a
bogus exit status in the process, but it was difficult to observe this
because we would be cancelling anyways. But set it properly.
2019-12-17 18:19:38 -08:00
ridiculousfish
b3d2cdc0ff Unify parse_execution_result_t and eval_result_t again
Do other cleanup to better express the difference between cancellation
and control flow.
2019-12-17 18:12:49 -08:00
ridiculousfish
b82b111e55 Revert "Unify parse_execution_result_t and eval_result_t"
This reverts commit c011f3a8e9.

There is a bug where cancellation is being reported for normal control
flow, not just for SIGINT.
2019-12-17 17:31:18 -08:00
ridiculousfish
c011f3a8e9 Unify parse_execution_result_t and eval_result_t
These are just the same thing now; make everything eval_result_t.
2019-12-17 16:52:15 -08:00