Skip to content

Commit 5ef9c17

Browse files
Revert 20e4def (preformatted_output flag)
1 parent 3d4c794 commit 5ef9c17

File tree

7 files changed

+42
-96
lines changed

7 files changed

+42
-96
lines changed

src/cbmc/bmc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void bmct::error_trace()
6464
{
6565
xmlt xml;
6666
convert(ns, goto_trace, xml);
67-
status() << preformatted_output << xml << eom;
67+
status() << xml << eom;
6868
}
6969
break;
7070

@@ -81,7 +81,7 @@ void bmct::error_trace()
8181
result["status"]=json_stringt("failed");
8282
jsont &json_trace=result["trace"];
8383
convert(ns, goto_trace, json_trace);
84-
status() << preformatted_output << json_result << eom;
84+
status() << ",\n" << json_result << eom;
8585
}
8686
break;
8787
}

src/util/cout_message.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ cerr_message_handlert::cerr_message_handlert():
3131

3232
void console_message_handlert::print(
3333
unsigned level,
34-
const std::string &message,
35-
bool preformatted)
34+
const std::string &message)
3635
{
37-
message_handlert::print(level, message, preformatted);
36+
message_handlert::print(level, message);
3837

3938
if(verbosity<level)
4039
return;
@@ -102,8 +101,7 @@ void gcc_message_handlert::print(
102101
unsigned level,
103102
const std::string &message,
104103
int sequence_number,
105-
const source_locationt &location,
106-
bool preformatted)
104+
const source_locationt &location)
107105
{
108106
const irep_idt file=location.get_file();
109107
const irep_idt line=location.get_line();
@@ -141,15 +139,14 @@ void gcc_message_handlert::print(
141139

142140
dest+=message;
143141

144-
print(level, dest, preformatted);
142+
print(level, dest);
145143
}
146144

147145
void gcc_message_handlert::print(
148146
unsigned level,
149-
const std::string &message,
150-
bool preformatted)
147+
const std::string &message)
151148
{
152-
message_handlert::print(level, message, preformatted);
149+
message_handlert::print(level, message);
153150

154151
// gcc appears to send everything to cerr
155152
if(verbosity>=level)

src/util/cout_message.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class console_message_handlert:public ui_message_handlert
3232
// level 4 and upwards go to cout, level 1-3 to cerr
3333
virtual void print(
3434
unsigned level,
35-
const std::string &message,
36-
bool preformatted) override;
35+
const std::string &message) override;
3736

3837
virtual void flush(unsigned level) override;
3938
};
@@ -44,15 +43,13 @@ class gcc_message_handlert:public ui_message_handlert
4443
// aims to imitate the messages gcc prints
4544
virtual void print(
4645
unsigned level,
47-
const std::string &message,
48-
bool preformatted) override;
46+
const std::string &message) override;
4947

5048
virtual void print(
5149
unsigned level,
5250
const std::string &message,
5351
int sequence_number,
54-
const source_locationt &location,
55-
bool preformatted) override;
52+
const source_locationt &location) override;
5653
};
5754

5855
#endif // CPROVER_UTIL_COUT_MESSAGE_H

src/util/message.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ void message_handlert::print(
1313
unsigned level,
1414
const std::string &message,
1515
int sequence_number,
16-
const source_locationt &location,
17-
bool preformatted)
16+
const source_locationt &location)
1817
{
1918
std::string dest;
2019

@@ -52,13 +51,12 @@ void message_handlert::print(
5251
dest+=": ";
5352
dest+=message;
5453

55-
print(level, dest, preformatted);
54+
print(level, dest);
5655
}
5756

5857
void message_handlert::print(
5958
unsigned level,
60-
const std::string &message,
61-
bool preformatted)
59+
const std::string &message)
6260
{
6361
if(level>=message_count.size())
6462
message_count.resize(level+1, 0);

src/util/message.h

+11-33
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ class message_handlert
2424
{
2525
}
2626

27-
virtual void print(
28-
unsigned level,
29-
const std::string &message,
30-
bool preformatted) = 0;
27+
virtual void print(unsigned level, const std::string &message) = 0;
3128

3229
virtual void print(
3330
unsigned level,
3431
const std::string &message,
3532
int sequence_number,
36-
const source_locationt &location,
37-
bool preformatted);
33+
const source_locationt &location);
3834

3935
virtual void flush(unsigned level)
4036
{
@@ -64,22 +60,18 @@ class message_handlert
6460
class null_message_handlert:public message_handlert
6561
{
6662
public:
67-
virtual void print(
68-
unsigned level,
69-
const std::string &message,
70-
bool preformatted)
63+
virtual void print(unsigned level, const std::string &message)
7164
{
72-
message_handlert::print(level, message, preformatted);
65+
message_handlert::print(level, message);
7366
}
7467

7568
virtual void print(
7669
unsigned level,
7770
const std::string &message,
7871
int sequence_number,
79-
const source_locationt &location,
80-
bool preformatted)
72+
const source_locationt &location)
8173
{
82-
print(level, message, preformatted);
74+
print(level, message);
8375
}
8476
};
8577

@@ -90,12 +82,9 @@ class stream_message_handlert:public message_handlert
9082
{
9183
}
9284

93-
virtual void print(
94-
unsigned level,
95-
const std::string &message,
96-
bool preformatted)
85+
virtual void print(unsigned level, const std::string &message)
9786
{
98-
message_handlert::print(level, message, preformatted);
87+
message_handlert::print(level, message);
9988

10089
if(verbosity>=level)
10190
out << message << '\n';
@@ -172,23 +161,20 @@ class messaget
172161
unsigned _message_level,
173162
messaget &_message):
174163
message_level(_message_level),
175-
message(_message),
176-
preformatted(false)
164+
message(_message)
177165
{
178166
}
179167

180168
mstreamt(const mstreamt &other):
181169
message_level(other.message_level),
182170
message(other.message),
183-
source_location(other.source_location),
184-
preformatted(false)
171+
source_location(other.source_location)
185172
{
186173
}
187174

188175
unsigned message_level;
189176
messaget &message;
190177
source_locationt source_location;
191-
bool preformatted;
192178

193179
template <class T>
194180
mstreamt &operator << (const T &x)
@@ -214,23 +200,15 @@ class messaget
214200
m.message_level,
215201
m.str(),
216202
-1,
217-
m.source_location,
218-
m.preformatted);
203+
m.source_location);
219204
m.message.message_handler->flush(m.message_level);
220205
}
221-
m.preformatted=false;
222206
m.clear(); // clears error bits
223207
m.str(std::string()); // clears the string
224208
m.source_location.clear();
225209
return m;
226210
}
227211

228-
static mstreamt &preformatted_output(mstreamt &m)
229-
{
230-
m.preformatted=true;
231-
return m;
232-
}
233-
234212
// in lieu of std::endl
235213
static mstreamt &endl(mstreamt &m)
236214
{

src/util/ui_message.cpp

+12-31
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ const char *ui_message_handlert::level_string(unsigned level)
9090

9191
void ui_message_handlert::print(
9292
unsigned level,
93-
const std::string &message,
94-
bool preformatted)
93+
const std::string &message)
9594
{
9695
if(verbosity>=level)
9796
{
@@ -100,7 +99,7 @@ void ui_message_handlert::print(
10099
case uit::PLAIN:
101100
{
102101
console_message_handlert console_message_handler;
103-
console_message_handler.print(level, message, preformatted);
102+
console_message_handler.print(level, message);
104103
}
105104
break;
106105

@@ -109,7 +108,7 @@ void ui_message_handlert::print(
109108
{
110109
source_locationt location;
111110
location.make_nil();
112-
print(level, message, -1, location, preformatted);
111+
print(level, message, -1, location);
113112
}
114113
break;
115114
}
@@ -120,18 +119,17 @@ void ui_message_handlert::print(
120119
unsigned level,
121120
const std::string &message,
122121
int sequence_number,
123-
const source_locationt &location,
124-
bool preformatted)
122+
const source_locationt &location)
125123
{
126-
message_handlert::print(level, message, preformatted);
124+
message_handlert::print(level, message);
127125

128126
if(verbosity>=level)
129127
{
130128
switch(get_ui())
131129
{
132130
case uit::PLAIN:
133131
message_handlert::print(
134-
level, message, sequence_number, location, preformatted);
132+
level, message, sequence_number, location);
135133
break;
136134

137135
case uit::XML_UI:
@@ -147,7 +145,7 @@ void ui_message_handlert::print(
147145
std::string sequence_number_str=
148146
sequence_number>=0?std::to_string(sequence_number):"";
149147

150-
ui_msg(type, tmp_message, sequence_number_str, location, preformatted);
148+
ui_msg(type, tmp_message, sequence_number_str, location);
151149
}
152150
break;
153151
}
@@ -158,20 +156,19 @@ void ui_message_handlert::ui_msg(
158156
const std::string &type,
159157
const std::string &msg1,
160158
const std::string &msg2,
161-
const source_locationt &location,
162-
bool preformatted)
159+
const source_locationt &location)
163160
{
164161
switch(get_ui())
165162
{
166163
case uit::PLAIN:
167164
break;
168165

169166
case uit::XML_UI:
170-
xml_ui_msg(type, msg1, msg2, location, preformatted);
167+
xml_ui_msg(type, msg1, msg2, location);
171168
break;
172169

173170
case uit::JSON_UI:
174-
json_ui_msg(type, msg1, msg2, location, preformatted);
171+
json_ui_msg(type, msg1, msg2, location);
175172
break;
176173
}
177174
}
@@ -180,16 +177,8 @@ void ui_message_handlert::xml_ui_msg(
180177
const std::string &type,
181178
const std::string &msg1,
182179
const std::string &msg2,
183-
const source_locationt &location,
184-
bool preformatted)
180+
const source_locationt &location)
185181
{
186-
if(preformatted)
187-
{
188-
// Expect the message is already an XML fragment.
189-
std::cout << msg1 << '\n';
190-
return;
191-
}
192-
193182
xmlt result;
194183
result.name="message";
195184

@@ -208,16 +197,8 @@ void ui_message_handlert::json_ui_msg(
208197
const std::string &type,
209198
const std::string &msg1,
210199
const std::string &msg2,
211-
const source_locationt &location,
212-
bool preformatted)
200+
const source_locationt &location)
213201
{
214-
if(preformatted)
215-
{
216-
// Expect the message is already a JSON fragment.
217-
std::cout << ",\n" << msg1;
218-
return;
219-
}
220-
221202
json_objectt result;
222203

223204
if(location.is_not_nil() &&

src/util/ui_message.h

+5-10
Original file line numberDiff line numberDiff line change
@@ -44,37 +44,32 @@ class ui_message_handlert:public message_handlert
4444
// overloading
4545
virtual void print(
4646
unsigned level,
47-
const std::string &message,
48-
bool preformatted);
47+
const std::string &message);
4948

5049
// overloading
5150
virtual void print(
5251
unsigned level,
5352
const std::string &message,
5453
int sequence_number,
55-
const source_locationt &location,
56-
bool preformatted);
54+
const source_locationt &location);
5755

5856
virtual void xml_ui_msg(
5957
const std::string &type,
6058
const std::string &msg1,
6159
const std::string &msg2,
62-
const source_locationt &location,
63-
bool preformatted);
60+
const source_locationt &location);
6461

6562
virtual void json_ui_msg(
6663
const std::string &type,
6764
const std::string &msg1,
6865
const std::string &msg2,
69-
const source_locationt &location,
70-
bool preformatted);
66+
const source_locationt &location);
7167

7268
virtual void ui_msg(
7369
const std::string &type,
7470
const std::string &msg1,
7571
const std::string &msg2,
76-
const source_locationt &location,
77-
bool preformatted);
72+
const source_locationt &location);
7873

7974
const char *level_string(unsigned level);
8075
};

0 commit comments

Comments
 (0)