gbranden pushed a commit to branch master
in repository groff.
commit 1179e0e2c838730768acebafb121eca62ccc0a39
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 16 16:49:58 2026 -0600
[pic]: Apply the C++ "rule of three".
* src/preproc/pic/lex.cpp (class input_stack): Define stub constructor
to prevent instantiation of static class.
* src/preproc/pic/pic.h (class input): Define stub copy constructor and
assignment operator.
---
ChangeLog | 9 +++++++++
src/preproc/pic/lex.cpp | 3 +++
src/preproc/pic/pic.h | 2 ++
3 files changed, 14 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index ac17944bc..d7ca5a22c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-11-16 G. Branden Robinson <[email protected]>
+
+ [pic]: Apply the C++ "rule of three".
+
+ * src/preproc/pic/lex.cpp (class input_stack): Define stub
+ constructor to prevent instantiation of static class.
+ * src/preproc/pic/pic.h (class input): Define stub copy
+ constructor and assignment operator.
+
2026-11-16 G. Branden Robinson <[email protected]>
* src/preproc/pic/lex.cpp: Boolify "BOL" handling.
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index b437f261c..af5cbd7c0 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -272,7 +272,10 @@ int argument_macro_input::peek()
return (unsigned char)*p;
}
+// Because the constructor is private, we don't need to prohibit copy or
+// assignment.
class input_stack {
+ input_stack(); // prohibit instantiation
static input *current_input;
static bool at_beginning_of_line;
public:
diff --git a/src/preproc/pic/pic.h b/src/preproc/pic/pic.h
index 99df80ce4..7db1c2f0f 100644
--- a/src/preproc/pic/pic.h
+++ b/src/preproc/pic/pic.h
@@ -50,6 +50,8 @@ extern void do_lookahead();
class input {
input *next;
+ input(const input &); // prohibit copying
+ input &operator=(const input &); // prohibit assignment
public:
input();
virtual ~input();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit