diff options
author | Reinhold Kainhofer <reinhold@kainhofer.com> | 2011-08-07 19:13:04 +0200 |
---|---|---|
committer | Reinhold Kainhofer <reinhold@kainhofer.com> | 2011-08-14 16:30:16 +0200 |
commit | 638ad29c79717fc1ba895b14aee256dd3a03f25b (patch) | |
tree | 4a93afefaeafd70ed8ad528fa4fb84fdf6177d85 | |
parent | 1d142bf5ed6b0df3b9f54cf65005c8ba31d219e6 (diff) |
Get rid of some compiler warnings; Fix chdir handling of errors
-) Some "unused parameter" warnings
-) Some "ignoring return value" are a bit trickier. They are bad coding style:
o) the file-name.cc one returns a string with undefined contents if getcwd
fails, which might either crash guile or lead to other bugs.
o) the lily-parser-scheme.cc warning was also a programming error (if you
used --output=dir/file, and dir/ had the wrong permissions, then
lilypond would not print an error, but simply put the output file into
the current directory without telling the user!).
In this case (output dir explicitly requested, but not possible
to change there), I think it's best to exit lilypond with an
error.
-) signed/unsigned warning in glissando-engraver.cc, where we already
had a check for negative values, so explicitly casting to unsigned
shuts up the compiler.
-) Remove unneccessary #(set-paper-size "a6") in the regtests
-) fix bad texinfo code in function documentation
-rw-r--r-- | flower/file-name.cc | 5 | ||||
-rw-r--r-- | input/regression/completion-heads-factor.ly | 2 | ||||
-rw-r--r-- | input/regression/completion-rest.ly | 2 | ||||
-rw-r--r-- | lily/glissando-engraver.cc | 2 | ||||
-rw-r--r-- | lily/lily-parser-scheme.cc | 15 | ||||
-rw-r--r-- | lily/lyric-combine-music-iterator.cc | 2 | ||||
-rw-r--r-- | lily/skyline.cc | 3 | ||||
-rw-r--r-- | ly/music-functions-init.ly | 2 | ||||
-rw-r--r-- | ly/predefined-fretboards-init.ly | 2 | ||||
-rw-r--r-- | scripts/build/extract_texi_filenames.py | 4 |
10 files changed, 17 insertions, 22 deletions
diff --git a/flower/file-name.cc b/flower/file-name.cc index 14812a034c..27ce6df6f8 100644 --- a/flower/file-name.cc +++ b/flower/file-name.cc @@ -97,9 +97,8 @@ string get_working_directory () { char cwd[PATH_MAX]; - getcwd (cwd, PATH_MAX); - - return string (cwd); + // getcwd returns NULL upon a failure, contents of cwd would be undefined! + return string (getcwd (cwd, PATH_MAX)); } /* Join components to full file_name. */ diff --git a/input/regression/completion-heads-factor.ly b/input/regression/completion-heads-factor.ly index a36da3accd..2f10a44c91 100644 --- a/input/regression/completion-heads-factor.ly +++ b/input/regression/completion-heads-factor.ly @@ -9,8 +9,6 @@ notes with a duration factor still keep their requested appearance. " } -#(set-paper-size "a6") - \layout { ragged-right= ##t } diff --git a/input/regression/completion-rest.ly b/input/regression/completion-rest.ly index 63aa5b37e0..034c3053c2 100644 --- a/input/regression/completion-rest.ly +++ b/input/regression/completion-rest.ly @@ -9,8 +9,6 @@ rests with a duration factor still keep their requested appearance. " } -#(set-paper-size "a6") - \layout { ragged-right= ##t } diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index 38270f446f..0248c8fe78 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -121,7 +121,7 @@ Glissando_engraver::acknowledge_note_column (Grob_info info) continue; int n1 = robust_scm2int (scm_car (candidate), -1); int n2 = robust_scm2int (scm_cdr (candidate), -1); - if (n1 < 0 || n2 < 0 || n1 >= note_heads.size ()) + if ((n1 < 0) || (n2 < 0) || (size_t(n1) >= note_heads.size ())) continue; note_column_1.push_back (vsize (n1)); note_column_2.push_back (vsize (n2)); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index ceefa6b038..1107af9995 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -70,19 +70,18 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", else { File_name out (output_name); - if (is_dir (out.dir_part ())) - { - dir = out.dir_part (); - out_file_name = out.file_part (); - } + dir = out.dir_part (); + out_file_name = out.file_part (); } if (dir != "" && dir != "." && dir != get_working_directory ()) { global_path.prepend (get_working_directory ()); - message (_f ("Changing working directory to: `%s'", - dir.c_str ())); - chdir (dir.c_str ()); + message (_f ("Changing working directory to: `%s'", dir)); + // If we can't change to the output dir (not existing, wrong + // permissions), exit lilypond + if (chdir (dir.c_str ()) != 0) + error (_f ("unable to change directory to: `%s'", dir)); } else out_file_name = File_name (output_name); diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index a6de96f5d3..3b2ee8548d 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -221,7 +221,7 @@ Lyric_combine_music_iterator::construct_children () IMPLEMENT_LISTENER (Lyric_combine_music_iterator, check_new_context) void -Lyric_combine_music_iterator::check_new_context (SCM sev) +Lyric_combine_music_iterator::check_new_context (SCM /*sev*/) { if (!ok ()) return; diff --git a/lily/skyline.cc b/lily/skyline.cc index b5288e2526..b6ea6b791b 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -392,7 +392,7 @@ Skyline::Skyline (Direction sky) added to it. */ -Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis a) +Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis /*a*/) { /* We extract boxes from the skyline, then build a new skyline from @@ -406,6 +406,7 @@ Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis a) list<Box> boxes; // establish a baseline box + // FIXME: This has hardcoded logic, assuming a == X_AXIS! boxes.push_back (Box (Interval (-infinity_f, infinity_f), Interval (0, 0))); list<Building>::const_iterator end = src.buildings_.end (); diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index f82ac0b4e3..e6b8a97f58 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -891,7 +891,7 @@ scaleDurations = shiftDurations = #(define-music-function (parser location dur dots arg) (integer? integer? ly:music?) - (_i "Scale @var{arg} up by a factor of @var{2^dur*(2-(1/2)^dots)}.") + (_i "Scale @var{arg} up by a factor of 2^@var{dur}*(2-(1/2)^@var{dots}).") (music-map (lambda (x) diff --git a/ly/predefined-fretboards-init.ly b/ly/predefined-fretboards-init.ly index 996470a161..2474405617 100644 --- a/ly/predefined-fretboards-init.ly +++ b/ly/predefined-fretboards-init.ly @@ -33,7 +33,7 @@ addChordShape = #(define-music-function (parser location key-symbol tuning shape-definition) (symbol? pair? string-or-pair?) (_i "Add chord shape @var{shape-definition} to the @var{chord-shape-table} -hash with the key @var{(cons key-symbol tuning)}.") +hash with the key @code{(cons @var{key-symbol} @var{tuning})}.") (hash-set! chord-shape-table (cons key-symbol tuning) shape-definition) diff --git a/scripts/build/extract_texi_filenames.py b/scripts/build/extract_texi_filenames.py index 7dd41eeade..a3577ae830 100644 --- a/scripts/build/extract_texi_filenames.py +++ b/scripts/build/extract_texi_filenames.py @@ -131,8 +131,8 @@ def expand_includes (m, filename): return extract_sections (filepath)[1] if not (include_name in known_missing_files): # Not found - print 'No such file: ' + include_name - print 'Search path: ' + ':'.join (include_path) + print 'Warning: No such file: ' + include_name + \ + ' (search path: ' + ':'.join (include_path)+')' return '' lang_re = re.compile (r'^@documentlanguage (.+)', re.M) |