Skip to content

Commit 08dd65a

Browse files
committed
Remove
using namespace std; from Riostream.h, which has huge consequences for all of ROOT. Riostream.h is now a simple wrapper for fstream, iostream, iomanip for backward compatibility; Riosfwd.h simply wraps iosfwd. Because of templates and their inline functions, Riostream.h needed to be included in headers, too (e.g. TParameter.h), which violated the assumption that Riostream.h is not exposing its using namespace std to headers. ROOT now requires R__ANSISTREAM, R__SSTREAM, which does not change the set of supported compilers. Without "using namespace std", several identifiers are now prefixed by std::; e.g. roofit/* source files now have a using namespace std to keep their coding style. TFile::MakeProject() now generates "using namespace std" to convert the CINT-style class names into C++ ones. git-svn-id: http://root.cern.ch/svn/root/trunk@44507 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent e754721 commit 08dd65a

File tree

955 files changed

+7417
-6984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

955 files changed

+7417
-6984
lines changed

build/package/msi/makemsi.cxx

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class MSIDirEntry {
5353
string GetId() const;
5454
MSIDir* GetParent() const {return fParent;}
5555

56-
virtual void WriteRecurse(ostream& out, string indent) const = 0;
57-
ostream& WriteLongShort(ostream& out) const;
56+
virtual void WriteRecurse(std::ostream& out, string indent) const = 0;
57+
std::ostream& WriteLongShort(std::ostream& out) const;
5858

5959
private:
6060
void SetShortName(bool dir);
@@ -77,26 +77,26 @@ class MSIDir: public MSIDirEntry {
7777

7878
void AddFile(const char* file);
7979

80-
void Write(ostream& out) const;
80+
void Write(std::ostream& out) const;
8181

8282
private:
83-
void WriteRecurse(ostream& out, string indent) const;
84-
void WriteComponentsRecurse(ostream& out, string indent) const;
83+
void WriteRecurse(std::ostream& out, string indent) const;
84+
void WriteComponentsRecurse(std::ostream& out, string indent) const;
8585
const char* GetGuid() const {
8686
if (!fgGuids.size() && !fgNewGuids.size()) SetupGuids();
87-
map<string, string>::const_iterator iGuid = fgGuids.find(GetId());
87+
std::map<string, string>::const_iterator iGuid = fgGuids.find(GetId());
8888
if (iGuid == fgGuids.end()) return CreateGuid();
8989
return iGuid->second.c_str();
9090
}
9191
const char* CreateGuid() const;
9292
static void SetupGuids();
9393
static void UpdateGuids();
9494

95-
map<string, MSIDir*> fSubdirs;
96-
list<MSIFile*> fFiles;
95+
std::map<string, MSIDir*> fSubdirs;
96+
std::list<MSIFile*> fFiles;
9797

98-
static map<string, string> fgGuids;
99-
static map<string, string> fgNewGuids; // guids created during this process
98+
static std::map<string, string> fgGuids;
99+
static std::map<string, string> fgNewGuids; // guids created during this process
100100
static const char* fgGuidFileName; // location of the GUID file
101101
};
102102

@@ -106,7 +106,7 @@ class MSIFile: public MSIDirEntry {
106106
public:
107107
MSIFile(const char* name, MSIDir* parent): MSIDirEntry(name, parent, false) {}
108108

109-
void WriteRecurse(ostream& out, string indent) const {
109+
void WriteRecurse(std::ostream& out, string indent) const {
110110
out << indent << "<File Id=\"" << GetId() << "\" ";
111111
WriteLongShort(out) << "DiskId=\"1\"></File>" << std::endl;
112112
};
@@ -130,11 +130,11 @@ void MSIDirEntry::SetShortName(bool dir) {
130130
string filename(GetPath());
131131
HANDLE hFind = ::FindFirstFile(filename.c_str(), &findData);
132132
if (hFind == INVALID_HANDLE_VALUE) {
133-
cerr << "Cannot find " << filename << endl;
133+
std::cerr << "Cannot find " << filename << std::endl;
134134
} else {
135135
bool foundDir = (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) > 0;
136136
if (foundDir == !dir)
137-
cerr << filename << " is not what I expected it to be!" << endl;
137+
std::cerr << filename << " is not what I expected it to be!" << std::endl;
138138
else
139139
fShortName = findData.cAlternateFileName;
140140
}
@@ -157,7 +157,7 @@ string MSIDirEntry::GetMyId() const {
157157
return ret;
158158
}
159159

160-
ostream& MSIDirEntry::WriteLongShort(ostream& out) const {
160+
std::ostream& MSIDirEntry::WriteLongShort(std::ostream& out) const {
161161
if (!fShortName.empty())
162162
out << "LongName=\"" << fLongName <<"\" Name=\"" << fShortName << "\" ";
163163
else out << "Name=\"" << fLongName << "\" ";
@@ -170,8 +170,8 @@ ostream& MSIDirEntry::WriteLongShort(ostream& out) const {
170170
// MSIDir DEFINITIONS
171171
////////////////////////////////////////////////////////////////////////////////
172172

173-
map<string, string> MSIDir::fgGuids;
174-
map<string, string> MSIDir::fgNewGuids;
173+
std::map<string, string> MSIDir::fgGuids;
174+
std::map<string, string> MSIDir::fgNewGuids;
175175
const char* MSIDir::fgGuidFileName = 0; // set to e.g. "guids.txt" make GUIDs persistent
176176

177177
void MSIDir::AddFile(const char* file) {
@@ -185,7 +185,7 @@ void MSIDir::AddFile(const char* file) {
185185
} else subdir.erase();
186186

187187
if (filename.empty()) {
188-
cerr << "Cannot add empty filename!" << endl;
188+
std::cerr << "Cannot add empty filename!" << std::endl;
189189
return;
190190
}
191191
if (subdir.empty()) fFiles.push_back(new MSIFile(filename.c_str(), this));
@@ -195,7 +195,7 @@ void MSIDir::AddFile(const char* file) {
195195
}
196196
}
197197

198-
void MSIDir::Write(ostream& out) const {
198+
void MSIDir::Write(std::ostream& out) const {
199199
const DWORD bufsize = MAX_PATH;
200200
char pwd[bufsize];
201201
DWORD len = ::GetCurrentDirectory(bufsize, pwd);
@@ -268,7 +268,7 @@ void MSIDir::Write(ostream& out) const {
268268
out << "</Wix>" << std::endl;
269269
}
270270

271-
void MSIDir::WriteRecurse(ostream& out, string indent) const {
271+
void MSIDir::WriteRecurse(std::ostream& out, string indent) const {
272272
// write to out recursively
273273
if (!fFiles.size() && !fSubdirs.size()) return;
274274

@@ -284,13 +284,13 @@ void MSIDir::WriteRecurse(ostream& out, string indent) const {
284284
<< GetGuid() << "\">" << std::endl;
285285
indent+=" ";
286286

287-
for (list<MSIFile*>::const_iterator iFile = fFiles.begin(); iFile != fFiles.end(); ++iFile) {
287+
for (std::list<MSIFile*>::const_iterator iFile = fFiles.begin(); iFile != fFiles.end(); ++iFile) {
288288
(*iFile)->WriteRecurse(out, indent);
289289
}
290290
indent.erase(indent.length()-3, 3);
291291
out << indent << "</Component>" << std::endl;
292292
}
293-
for (map<string, MSIDir*>::const_iterator iSubdir = fSubdirs.begin(); iSubdir != fSubdirs.end(); ++iSubdir)
293+
for (std::map<string, MSIDir*>::const_iterator iSubdir = fSubdirs.begin(); iSubdir != fSubdirs.end(); ++iSubdir)
294294
iSubdir->second->WriteRecurse(out, indent);
295295

296296
indent.erase(indent.length()-3, 3);
@@ -300,11 +300,11 @@ void MSIDir::WriteRecurse(ostream& out, string indent) const {
300300
}
301301
}
302302

303-
void MSIDir::WriteComponentsRecurse(ostream& out, string indent) const {
303+
void MSIDir::WriteComponentsRecurse(std::ostream& out, string indent) const {
304304
// write all components to out
305305
if (!fFiles.empty())
306306
out << indent << "<ComponentRef Id=\"Component_" << GetId() << "\" />" << std::endl;
307-
for (map<string, MSIDir*>::const_iterator iSubdir = fSubdirs.begin(); iSubdir != fSubdirs.end(); ++iSubdir)
307+
for (std::map<string, MSIDir*>::const_iterator iSubdir = fSubdirs.begin(); iSubdir != fSubdirs.end(); ++iSubdir)
308308
iSubdir->second->WriteComponentsRecurse(out, indent);
309309
}
310310

@@ -339,15 +339,15 @@ void MSIDir::UpdateGuids() {
339339

340340
std::ofstream out(fgGuidFileName, std::ios_base::app);
341341
if (!out) {
342-
cerr << "ERROR: cannot write to GUID file "
343-
<< fgGuidFileName << "!" << endl;
344-
cerr << "ERROR: You should NOT use this MSI file, but re-generate with with accessible GUID file!"
345-
<< endl;
342+
std::cerr << "ERROR: cannot write to GUID file "
343+
<< fgGuidFileName << "!" << std::endl;
344+
std::cerr << "ERROR: You should NOT use this MSI file, but re-generate with with accessible GUID file!"
345+
<< std::endl;
346346
return;
347347
}
348-
for (map<string, string>::const_iterator iGuid = fgNewGuids.begin(); iGuid != fgNewGuids.end(); ++iGuid)
349-
out << iGuid->first << " " << iGuid->second << endl;
350-
std::cout << "WARNING: new GUIDs created; please cvs checkin " << fgGuidFileName << "!" << endl;
348+
for (std::map<string, string>::const_iterator iGuid = fgNewGuids.begin(); iGuid != fgNewGuids.end(); ++iGuid)
349+
out << iGuid->first << " " << iGuid->second << std::endl;
350+
std::cout << "WARNING: new GUIDs created; please cvs checkin " << fgGuidFileName << "!" << std::endl;
351351
}
352352

353353

@@ -358,21 +358,21 @@ void MSIDir::UpdateGuids() {
358358

359359
int main(int argc, char *argv[]) {
360360
if (argc<4 || string(argv[2]) != "-T") {
361-
cerr << "USAGE: " << argv[0] << " <msifile> -T <inputlistfile>" << endl;
361+
std::cerr << "USAGE: " << argv[0] << " <msifile> -T <inputlistfile>" << std::endl;
362362
return 1;
363363
}
364364

365365
string outfile = argv[1];
366366
std::ofstream out(outfile.c_str());
367367
if (!out) {
368-
cerr << "Cannot open output file " << outfile << "!" << endl;
368+
std::cerr << "Cannot open output file " << outfile << "!" << std::endl;
369369
return 2;
370370
}
371371

372372
string infile = argv[3];
373373
std::ifstream in(infile.c_str());
374374
if (!in) {
375-
cerr << "Cannot open input file " << infile << "!" << endl;
375+
std::cerr << "Cannot open input file " << infile << "!" << std::endl;
376376
return 2;
377377
}
378378

cint/tool/makecint.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ void G__outputmakefile(int argc,char **argv)
757757
else if(G__flags & G__ismain) {
758758
#ifdef _AIX
759759
TODO!
760-
cout << "$(OBJECT) : $(CINTLIB) $(READLINEA) $(DLFCN) G__setup" << G__CFG_OBJEXT << " $(COFILES) $(CXXOFILES) $(CIFO) $(CXXIFO)";
760+
std::cout << "$(OBJECT) : $(CINTLIB) $(READLINEA) $(DLFCN) G__setup" << G__CFG_OBJEXT << " $(COFILES) $(CXXOFILES) $(CIFO) $(CXXIFO)";
761761
out << "\t";
762762
if (G__quiet) out << "@";
763763
out << "$(LD) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(CIFO) $(CXXIFO) $(COFILES) $(CXXOFILES) G__setup" << G__CFG_OBJEXT << " $(READLINEA) $(DLFCN) $(LIBS)"

core/base/inc/LinkDef1.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@
111111
#pragma link C++ function operator>(const char*,const TString&);
112112
#pragma link C++ function operator<=(const char*,const TString&);
113113
#pragma link C++ function operator>=(const char*,const TString&);
114-
#pragma link C++ function operator>>(istream&,TString&);
115-
#pragma link C++ function operator<<(ostream&,const TString&);
114+
#pragma link C++ function operator>>(std::istream&,TString&);
115+
#pragma link C++ function operator<<(std::ostream&,const TString&);
116116
//#pragma link C++ function operator>>(TBuffer&,TString&);
117117
//#pragma link C++ function operator<<(TBuffer&,const TString&);
118118
//#pragma link C++ function operator>>(TBuffer&,const TObject*&);

core/base/inc/LinkDef2.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@
2121
#pragma extra_include "iostream";
2222

2323
#pragma create TClass string;
24-
#pragma link C++ class vector<string>;
25-
#pragma link C++ operator vector<string>;
24+
#pragma link C++ class std::vector<string>;
25+
#pragma link C++ operator std::vector<string>;
2626
#ifdef G__VECTOR_HAS_CLASS_ITERATOR
27-
#pragma link C++ class vector<string>::iterator;
28-
#pragma link C++ class vector<string>::const_iterator;
29-
#pragma link C++ class vector<string>::reverse_iterator;
30-
#pragma link C++ operator vector<string>::iterator;
31-
#pragma link C++ operator vector<string>::const_iterator;
32-
#pragma link C++ operator vector<string>::reverse_iterator;
27+
#pragma link C++ class std::vector<string>::iterator;
28+
#pragma link C++ class std::vector<string>::const_iterator;
29+
#pragma link C++ class std::vector<string>::reverse_iterator;
30+
#pragma link C++ operator std::vector<string>::iterator;
31+
#pragma link C++ operator std::vector<string>::const_iterator;
32+
#pragma link C++ operator std::vector<string>::reverse_iterator;
3333
#endif
3434

35-
#pragma link C++ class vector<TString>;
36-
#pragma link C++ operators vector<TString>;
35+
#pragma link C++ class std::vector<TString>;
36+
#pragma link C++ operators std::vector<TString>;
3737
#ifdef G__VECTOR_HAS_CLASS_ITERATOR
38-
#pragma link C++ class vector<TString>::iterator;
39-
#pragma link C++ class vector<TString>::const_iterator;
40-
#pragma link C++ class vector<TString>::reverse_iterator;
41-
#pragma link C++ operator vector<TString>::iterator;
42-
#pragma link C++ operator vector<TString>::const_iterator;
43-
#pragma link C++ operator vector<TString>::reverse_iterator;
38+
#pragma link C++ class std::vector<TString>::iterator;
39+
#pragma link C++ class std::vector<TString>::const_iterator;
40+
#pragma link C++ class std::vector<TString>::reverse_iterator;
41+
#pragma link C++ operator std::vector<TString>::iterator;
42+
#pragma link C++ operator std::vector<TString>::const_iterator;
43+
#pragma link C++ operator std::vector<TString>::reverse_iterator;
4444
#endif
4545

4646
#include <vector>

core/base/inc/LinkDef3.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
#pragma link C++ struct Rectangle_t;
147147
#pragma link C++ struct timespec;
148148

149-
#pragma link C++ function operator<<(ostream&, const TTimeStamp&);
149+
#pragma link C++ function operator<<(std::ostream&, const TTimeStamp&);
150150
#pragma link C++ function operator<<(TBuffer&, const TTimeStamp&);
151151
#pragma link C++ function operator>>(TBuffer&, TTimeStamp&);
152152
#pragma link C++ function operator==(const TTimeStamp&, const TTimeStamp&);
@@ -226,11 +226,11 @@
226226
#pragma link C++ class std::pair<const char*,double>+;
227227
#pragma link C++ class std::pair<const char*,void*>+;
228228
#pragma link C++ class std::pair<const char*,char*>+;
229-
#pragma link C++ class std::pair<const string,int>+;
230-
#pragma link C++ class std::pair<const string,long>+;
231-
#pragma link C++ class std::pair<const string,float>+;
232-
#pragma link C++ class std::pair<const string,double>+;
233-
#pragma link C++ class std::pair<const string,void*>+;
229+
#pragma link C++ class std::pair<const std::string,int>+;
230+
#pragma link C++ class std::pair<const std::string,long>+;
231+
#pragma link C++ class std::pair<const std::string,float>+;
232+
#pragma link C++ class std::pair<const std::string,double>+;
233+
#pragma link C++ class std::pair<const std::string,void*>+;
234234
#pragma link C++ class std::pair<const int,int>+;
235235
#pragma link C++ class std::pair<const int,long>+;
236236
#pragma link C++ class std::pair<const int,float>+;

core/base/inc/RConfig.h

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828

2929
#define R__USE_SHADOW_CLASS
3030

31+
/* Now required, thus defined by default for backward compatibility */
32+
#define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
33+
#define R__SSTREAM /* use sstream or strstream header */
34+
35+
3136
/*---- machines --------------------------------------------------------------*/
3237

3338
#ifdef __hpux
@@ -50,7 +55,6 @@
5055
# define R__SEEK64
5156
# define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
5257
# define NEED_STRCASECMP
53-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
5458
#endif
5559

5660
#ifdef __linux
@@ -73,8 +77,6 @@
7377
# ifndef __USE_STD_IOSTREAM
7478
# define __USE_STD_IOSTREAM
7579
# endif
76-
# define R__ANSISTREAM
77-
# define R__SSTREAM
7880
# define R__TMPLTSTREAM
7981
# ifdef _XOPEN_SOURCE
8082
# if _XOPEN_SOURCE+0 > 0
@@ -126,8 +128,6 @@
126128
# define NEED_SIGJMP
127129
# if __SUNPRO_CC > 0x420
128130
# define R__SOLARIS_CC50
129-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
130-
# define R__SSTREAM /* use sstream or strstream header */
131131
# define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
132132
# endif
133133
# if __SUNPRO_CC >= 0x420
@@ -148,7 +148,6 @@
148148
# define R__UNIX
149149
# define NEED_STRING
150150
# define NEED_SIGJMP
151-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
152151
#endif
153152

154153
#if defined(__sgi) && !defined(linux)
@@ -169,9 +168,6 @@
169168
# define R__B64
170169
# undef R__SEEK64
171170
# endif
172-
# if !defined(__KCC)
173-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
174-
# endif
175171
#endif
176172

177173
#if defined(linux)
@@ -375,7 +371,6 @@
375371
# define R__UNIX
376372
# if defined(__xlC__) || defined(__xlc__)
377373
# define ANSICPP
378-
# define R__ANSISTREAM
379374
# define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
380375
# endif
381376
# if defined(__ppc64__)
@@ -412,16 +407,9 @@
412407
# if __GNUC__ >= 3 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)
413408
# define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
414409
# endif
415-
# if __GNUC__ >= 3 || __GNUC_MINOR__ >= 91 /* egcs 1.1.x */
416-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
417-
# endif
418-
# if __GNUC__ >= 3 && __GNUC_MINOR__ >=0 && __GNUC_MINOR__ < 8
419-
# define R__SSTREAM /* use sstream or strstream header */
420-
# endif
421410
# if defined(__ia64__) && __GNUC__ < 3 /* gcc 2.9x (MINOR is 9!) */
422411
# define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
423412
# define R__PLACEMENTDELETE /* supports overloading placement delete */
424-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
425413
# endif
426414
# if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ > 1)
427415
# define R__PRAGMA_DIAGNOSTIC
@@ -438,7 +426,6 @@
438426

439427
#ifdef __INTEL_COMPILER
440428
# define R__INTEL_COMPILER
441-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
442429
# define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
443430
# define R__PLACEMENTDELETE /* supports overloading placement delete */
444431
# define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
@@ -456,8 +443,7 @@
456443
# define R__GLOBALSTL /* STL in global name space */
457444
# else
458445
# define R__PLACEMENTDELETE /* supports overloading placement delete */
459-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
460-
# define R__TMPLTSTREAM /* iostream implemented with templates */
446+
# define R__TMPLTSTREAM /* std::iostream implemented with templates */
461447
# endif
462448
# ifndef _INCLUDE_LONGLONG
463449
# define _INCLUDE_LONGLONG
@@ -497,12 +483,6 @@
497483
# define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
498484
# define R__PLACEMENTDELETE /* supports overloading placement delete */
499485
# define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
500-
# if _MSC_VER >= 1200
501-
# define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
502-
# endif
503-
# if _MSC_VER >= 1310
504-
# define R__SSTREAM /* has <sstream> iso <strstream> */
505-
# endif
506486
# if _MSC_VER >= 1400
507487
# define DONTNEED_VSNPRINTF
508488
# endif

0 commit comments

Comments
 (0)