Commit Graph

67 Commits

Author SHA1 Message Date
Kurtis Rader
1f06e5f0b9 add better support for IWYU and fix things
Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.

Fixes #2957
2016-04-26 15:02:22 -07:00
Kurtis Rader
ea3d9c36a5 fix off by one error 2016-04-13 09:00:07 -07:00
Kurtis Rader
8e103c231e fish handling of readlink()
The readlink() function does not null terminate the path it returns.

Remove the OS X code that deals with a path buffer that is too short. For
one thing a loop isn't needed since we're told how big of a buffer
is required if the first _NSGetExecutablePath() call fails. But more
important it is so unlikely that the path will be longer than PATH_MAX
that if it is we should just give up.

Fixes 2931.
2016-04-12 19:03:07 -07:00
Kurtis Rader
9569f51e83 revert inadvertent file inclusion in prior commit
Commit 6431c0de16 was not meant to include
changes to fish.cpp.
2016-04-12 19:01:28 -07:00
Kurtis Rader
6431c0de16 fix bug in lint.fish helper script
I just noticed that depending on the state of your working tree there can be
one or more spaces after the modification token and the file name. If there is
more than one space that causes the `string split` to produce unexpected
output.
2016-04-12 18:32:20 -07:00
Kurtis Rader
de1258e09b fish --version should write to stdout
When explicitly asking for the fish version string the information
should go to stdout rather than stderr. Also, there is no reason to use
exit_without_destructors() rather than exit() in that code path. We
actually want the side-effects of exit() such as flushing stdout and
there aren't any threads or other things that could cause a normal exit
to fail when that function is run.
2016-03-23 11:42:17 -07:00
Andreas Nordal
2a4a539d86 Fix memory leak, error message when failing to open input file
The early return skipped all cleanup.
This problem is a case for the classic "goto fail" paradigm, but this
change instead makes a few adjustments to take advantage of a previously
unused level of indentation to conditionally execute the success path.

The error message now prints the filename instead of "open",
which should be more idiomatic.

Tip:
This patch makes sense if viewed with `git show --ignore-space-change`.
2016-03-22 11:43:58 -07:00
Kurtis Rader
6a16bdb808 assume getopt/getopt_long is available
There is no longer a good reason to detect whether or not getopt_long()
is available. All UNIX implementations we're likely to run on have it. And
if we ever find one that doesn't the right thing to do is not fallback to
getopt() but to include the getopt_long() source in our package like we
do with the pcre2 library. Since it's licensed under LGPL we can legally
do so if it becomes necessary.

This partially addresses issue #2790.
2016-03-08 13:38:57 -08:00
Kurtis Rader
f2246dfb34 reduce number of Unicode private-use characters
This narrows the range of Unicode codepoints fish reserves for its own
use from U+E000 thru U+F8FE (6399 codepoints) to U+F600 thru U+F73F (320
codepoints). This is still not ideal since fish shouldn't be using any
Unicode private-use codepoints but it's a step in the right direction.

This partially addresses issue #2684.
2016-02-28 18:36:34 -08:00
Kurtis Rader
1d446b74ff when sourcing config.fish do not redirect stderr
All versions of fish prior to this change silently discarded anything written
to stderr while source a config.fish file. Apparently just to avoid having
the source command display an error if the file did not exist. This can mask
real problems. So instead this change explicitly checks whether the file is
readable and silently skips sourcing it if it isn't.

Resolves issue #2702.
2016-02-04 12:52:50 -08:00
ridiculousfish
bc3260402a Don't resolve paths for files run from argv
Before this change, `fish ./test.fish` would fully resolve the
relative paths and symlinks of test.fish, as reported by `status -f`.
However `source` would not. With this change, both cases return relative
paths. `realpath` may be used by scripts to resolve them.

Fixes #2643
2016-01-03 12:12:53 -08:00
ridiculousfish
1363c7468d "Stop" should be "stomp" in fish.cpp comment 2015-12-29 16:39:28 -08:00
ridiculousfish
172f1e1b5f getopt long_options to be const 2015-12-21 20:32:05 -08:00
Kurtis Rader
b257e79a07 simplify fish_parse_opt
While investigating issue #2619 my first thought was that the problem
had something to do with the "is_interactive_session" global variable.
That preliminary conclusion appears to be wrong (i.e., the problem
lies elsewhere). However, that hypothesis caused me to look at function
"fish_parse_opt" and other mentions of "is_interactive_session".

I decided to take the opportunity to simplify and improve the style of
"fish_parse_opt" since I just spent an hour reviewing the code that
references "is_interactive_session". For example, the "has_cmd" variable
isn't really needed. And there is inconsistent whitespace not to mention
confusion about bool's versus int's and zero versus NULL.
2015-12-21 20:07:18 -08:00
ridiculousfish
70548f7cc7 Initial implementation of wildcard match refactoring
Not yet turned on.
2015-08-08 13:55:43 -07:00
David Adam
3929e9de0e Merge branch 'master' into iwyu 2015-07-26 10:20:13 +08:00
ridiculousfish
b4f53143b0 Migrate source files into src/ directory
This change moves source files into a src/ directory,
and puts object files into an obj/ directory. The Makefile
and xcode project are updated accordingly.

Fixes #1866
2015-07-24 00:59:27 -07:00