Commit Graph

14671 Commits

Author SHA1 Message Date
Aaron Gyes
172601299f builtin _ is now a reserved keyword
Similar to `test`, `_` is so likely to at least slow down if not
break all things catastrophically that it ought not be allowed as a
function name. Fixes #8342
2021-10-11 00:27:44 -07:00
Fabian Homborg
8784253282 Ye olde changelogge 2021-10-07 20:46:59 +02:00
Fabian Homborg
6af3896217 wcsfilecmp: Stop actually computing the numbers
This just compares two longs as strings on the go.

We can simply

1. ignore leading zeroes - they have no influence on the value
2. compare the digits char-by-char
3. keep the comparison for the first differing digit
4. if one number is longer than the other, that is larger
5. if the numbers have the same length, the one larger in the first
differing digit is larger

This makes this comparison quite a bit faster, which makes globs in
directories with numbered files up to 20% faster.

Note that, for historical reasons, this still ignores whitespace right
after the numbers!
2021-10-07 17:57:52 +02:00
Aaron Gyes
01919f1785 Update Mac.cmake 2021-10-06 19:42:25 -07:00
Aaron Gyes
8259bf7c7e Remove hack for Terminal.app that did not support 256 colors
We didn't support that version of macOS even before we bumped to
10.10.
2021-10-06 19:36:18 -07:00
Aaron Gyes
7122209f25 Remove old OS X stuff from keybindings
We don't support older than 10.10 anymore.

fish_key_reader reports the hardcoded bind we had for Mavericks
is just -k sdc.
2021-10-06 19:29:13 -07:00
Aaron Gyes
6fde56ff2d Mac.cmake: set deployment target to 10.10 per new min requirement 2021-10-06 16:51:11 -07:00
takeokunn
4a3b954a48 Update CHANGELOG 2021-10-06 14:51:26 -07:00
takeokunn
d557445875 Add roswell completion 2021-10-06 14:51:26 -07:00
takeokunn
08b75d2358 Add sbcl completion 2021-10-06 14:51:26 -07:00
ridiculousfish
83799228fe Relnote ending support for Mac OS 10.9
Mac OS 10.9 does not have the fstatat function which fish started
calling in commit 71a0d839a7. Let's end support for 10.9, which was
released in 2013.
2021-10-06 14:37:26 -07:00
Johannes Altmanninger
cb5a3fd9a1 completions/man: offer file completions when appropriate
Suggest files to "man -l", but only if the "-l" option is supported
(so not on BSD). Technically we should accept multiple files but this
seems good enough.

Also suggest files when the token-at-cursor contains a slash, because
man will treat arguments as file paths if they contain a /.
2021-10-05 21:53:17 +02:00
Anselm Schüler
475a2afc40
fish_prompt: clarify comment about carried-over status (#8335) 2021-10-05 21:01:13 +02:00
zaleoth
df9f01dd50
completions/ip: Use command (#8334)
Add "command" directive in front of ip commands to prevent bug from a buggy aliased "ip"
2021-10-05 20:47:49 +02:00
Mahmoud Al-Qudsi
86a442fb62 Make find_weak_odrs work with Python 3.6
`text` is an alias for `universal_newlines` but wasn't introduced until
Python 3.7
2021-10-04 19:45:36 -05:00
Mahmoud Al-Qudsi
fe63c8ad32 Shadow/override iswdigit instead of changing it at individual call sites
1ab81ab90d removed one usage of iswdigit()
but there are others; more importantly, the knowledge that iswdigit() is
slow isn't preserved anywhere apart from the git history, so there's
nothing to prevent its use from creeping back into the codebase.

Another alternative is to blacklist iswdigit() (shadow it with a
function of the same name that throws a static_assert) but if we're
going to shadow it anyway, might as well make it useful.
2021-10-04 18:44:16 -05:00
Mahmoud Al-Qudsi
72e50d1ab2 Revert "wcsfilecmp: Don't use iswdigit"
This reverts commit 1ab81ab90d.
2021-10-04 18:08:18 -05:00
Johannes Altmanninger
f674c4b010 completions/git: treat more T files as modified
git-status --porcelain prints status letter T when a file changed type
between either regular file, symlink or submodule.  It can occur in
exactly the same cases as M (modified), so extend the fix for #8311
accordingly.

For submodules, our completions are probably not always correct,
hopefully those cases are rare.
2021-10-04 21:45:14 +02:00
Aaron Gyes
f9def20180 Update ConfigureChecks, only do the mtime hack for Linux.. on Linux
- Only check for HAVE_CLOCK_GETTIME and HAVE_FUTIMENS on Linux, since
they are only used to implement a Linux-specific workaround related
to mtime precision.
- Make sure that hack is limited to Linux builds
- HAVE_SYS_SYSCTL_H was unused, but we should have been using it
- HAVE_TERMIOS_H was unused, remove it

The only functional change is that unix machines with clock_gettime
and futimens will not bother with a Linux-specific hack, and won't
waste time checking for either during cmake configuration either.
2021-10-02 17:02:53 -07:00
Fabian Homborg
1ab81ab90d wcsfilecmp: Don't use iswdigit
For some godforsaken reason it's slow on glibc

Like, actually, this manages to somehow make "echo **" 10% faster now?

The spec says this matches 0 through 9 always, so this is safe. We
also use this logic in a variety of other places already.
2021-10-01 19:14:27 +02:00
Fabian Homborg
71a0d839a7 wildcard: Use fstatat
This allows us to skip re-wcs2stringing the base_dir again and again
by simply using the fd. It's about 10% faster in my testing.

fstatat is defined by POSIX, so it should be available everywhere.
2021-10-01 19:14:27 +02:00
Aaron Gyes
54369ba61b use add_compile_options() instead of manipulating CMAKE_CXX_FLAGS 2021-10-01 09:10:32 -07:00
Aaron Gyes
2f29bb5b51 remove unused macros 2021-10-01 09:07:08 -07:00
Aaron Gyes
39bdabcd29 Don't add these warnings on GCC. 2021-10-01 05:09:04 -07:00
Aaron Gyes
dcaa9c7959 fix incorrect error message for 'end --foo' 2021-10-01 04:54:02 -07:00
Aaron Gyes
55ab2f6e6d Remove some unsued macros and a template 2021-10-01 04:50:19 -07:00
Aaron Gyes
d0f697be64 Update CMakeLists.txt
Revert the change getting rid of the -UNDEBUG, add some unused-blah
warnings.

We are often using the system assert() because we include other
headers that include assert.h.

I noticed that assert() was being compiled out because I started
getting new warnings printed about unusued variables (that were only
used in the assert()s. Add these warnings to the build.
2021-10-01 04:46:32 -07:00
Aaron Gyes
d2f47e0523 add missing header 2021-10-01 03:40:32 -07:00
Aaron Gyes
831e9082d7 enum_map stuff to enum_map.h 2021-10-01 03:39:43 -07:00
Noorhteen Raja NJ
3e345dccb9 Update ldapsearch.fish 2021-09-30 12:23:39 -07:00
Noorhteen Raja NJ
9b9a637e5c Update duply.fish 2021-09-30 12:21:20 -07:00
Jony
7df5efe317 completions/xbps-query: add missing -p completions 2021-09-30 12:13:42 -07:00
ridiculousfish
15cee66df1 Wrap even more stuff in anonymous namespaces 2021-09-30 11:33:03 -07:00
ridiculousfish
89c02cfe81 Put lots of things in anonymous namespaces
This is an attempt to help prevent ODR violations by making stuff local
to a file, instead of emitting weak symbols.
2021-09-30 11:33:03 -07:00
ridiculousfish
accba09709 Remove entry_was_evicted from LRU
This was no longer used. This allows us to remove the CRTP bits as well.
2021-09-30 11:33:03 -07:00
ridiculousfish
a6010519df Put ast_t::populator_t into an anonymous namespace
This is part of an effort to reduce the number of weak symbols, so we
can help prevent ODR errors. No functional change here.
2021-09-30 11:33:03 -07:00
ridiculousfish
799a2abac1 Add script to detect ODR violations
This is a little script that can be run manually to try and detect ODR
violations. It works by looking for weak symbols in .o files where the
symbol has the same name and different sizes.
2021-09-30 11:33:03 -07:00
Fabian Homborg
78fcbed6f2 wcsfilecmp: Skip towlower/upper if unnecessary
Also for the glob version, because this is just a performance thing.

Makes `echo **` 20% faster - 100ms to 80ms for the fish repo.

This also applies to the future `path` builtin.

Still not a speed demon, but this is a very very easy win.

Now we probably gotta do globbing all in string instead of wcs2stringing ourselves to death.
2021-09-30 18:09:58 +02:00
Fabian Homborg
4ffabd44be Don't add expansion error offset twice
Like the $status commit, this would add the offset to already existing
errors, so

```fish
(foo)
(bar)

something
```

would see the "(foo)" error, store the correct error location, then
see the "(bar)" error, and *add the offset of (bar)* to the "(foo)"
error location.

Solve this by making a new error list and appending it to the existing
ones.

There's a few other ways to solve this, including:

- Stopping after the first error (we only display the first anyway, I
think?)
- Making it so the source location has an "absolute" flag that shows
the offset has already been added (but do we ever need to add two offsets?)

I went with the simpler fix.
2021-09-30 18:09:58 +02:00
Fabian Homborg
6774a514fa Don't set error offset for $status
This would break the location of any prior errors without doing
anything of value.

E.g.

```fish
echo foo | exec grep # this exec is not allowed!

$status

somethingelse # The error might be found here!
```

Would apply the offset of `$status` to the offset of `exec`, locating
the error for `exec` somewhere after $status!
2021-09-30 18:09:58 +02:00
Adam Skoufis
d619d79117
Fix typo in set_colors command documentation (#8321)
* Fix typo in `set_colors` command documentation
* Replace `It` with `VALUE` to reduce ambiguity
2021-09-29 08:17:21 -07:00
Aaron Gyes
35bd06a13e fish_config: adjust output
Do not show an error on `fish_config prompt save` after removing a
`fish_right_prompt`
2021-09-29 03:15:37 -07:00
Aaron Gyes
f3b950157d Remove special case for fish_right_prompt in config.fish 2021-09-29 03:12:39 -07:00
Aaron Gyes
ed8c78c0ea Update docs, completions for funcsave
Remove long opt for -q, funcsave does not have so many options that
it's any help.
2021-09-29 03:08:10 -07:00
Aaron Gyes
fb32872f6b don't use __has_builtin
GCC doesn't have this until GCC 10. Just assume it exists, as
our compiler requirements mean it should exist.
2021-09-28 23:54:17 -07:00
Aaron Gyes
97bb53e32d Add likely() and unlikely() for our assertions
Allows the compiler to know our bespoke assert functions
are cold paths. This would normally occur somehow for real assert().
Assembly does appear it will save some branches.

Also don't worry about NDEBUG

(This doesn't matter because we rolled our own assert functions.
Thanks @zanchey.)
2021-09-28 23:39:54 -07:00
Aaron Gyes
a5978eade4 funcsave: add missing newlines 2021-09-28 22:22:21 -07:00
Aaron Gyes
3fd2da951e remove unused futimes check 2021-09-28 22:02:14 -07:00
Aaron Gyes
0b3d3de9bf Just add -UNDEBUG to disable NDEBUG. 2021-09-28 22:02:14 -07:00
Aaron Gyes
3a402b19b3 funcsave: delete files for non-existant functions, output actions unless -q
This allows for:

$ functions -e somefunc
$ funcsave somefunc

to work.
2021-09-28 22:01:07 -07:00