aboutsummaryrefslogtreecommitdiff
path: root/build2/depdb.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-26 11:51:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-26 11:51:45 +0200
commitbf497c1f7716e6d904245409bfe65cb8970fe4ae (patch)
tree22d73f63933330039d8c883637263d0dc903c41c /build2/depdb.cxx
parent896c2e1af6a8a82c976651d757115ea1033e7b82 (diff)
Implement module map storage in .d, use -fmodule-file-map in GCC
Diffstat (limited to 'build2/depdb.cxx')
-rw-r--r--build2/depdb.cxx45
1 files changed, 41 insertions, 4 deletions
diff --git a/build2/depdb.cxx b/build2/depdb.cxx
index 5aa2970..c74536c 100644
--- a/build2/depdb.cxx
+++ b/build2/depdb.cxx
@@ -123,8 +123,41 @@ namespace build2
return &line_;
}
+ bool depdb::
+ skip ()
+ {
+ if (state_ == state::read_eof)
+ return true;
+
+ assert (state_ == state::read);
+
+ // The rest is pretty similar in logic to read_() above.
+ //
+ pos_ = fs_.tellg ();
+
+ // Keep reading lines checking for the end marker after each newline.
+ //
+ fstream::int_type c;
+ do
+ {
+ if ((c = fs_.get ()) == '\n')
+ {
+ if ((c = fs_.get ()) == '\0')
+ {
+ state_ = state::read_eof;
+ return true;
+ }
+ }
+ } while (c != fstream::traits_type::eof ());
+
+ // Invalid database so change over to writing.
+ //
+ change ();
+ return false;
+ }
+
void depdb::
- write (const char* s, size_t n)
+ write (const char* s, size_t n, bool nl)
{
// Switch to writing if we are still reading.
//
@@ -132,11 +165,13 @@ namespace build2
change ();
fs_.write (s, static_cast<streamsize> (n));
- fs_.put ('\n');
+
+ if (nl)
+ fs_.put ('\n');
}
void depdb::
- write (char c)
+ write (char c, bool nl)
{
// Switch to writing if we are still reading.
//
@@ -144,7 +179,9 @@ namespace build2
change ();
fs_.put (c);
- fs_.put ('\n');
+
+ if (nl)
+ fs_.put ('\n');
}
void depdb::