[PATCH] Setup: Fix erroneous quoting of __LINE__ and __FILE__
Igor Pechtchanski
pechtcha@cs.nyu.edu
Sat Jul 12 00:50:00 GMT 2003
On Sat, 12 Jul 2003, Max Bowsher wrote:
> Igor Pechtchanski wrote:
> > On 12 Jul 2003, Robert Collins wrote:
> >
> >> On Sat, 2003-07-12 at 01:20, Igor Pechtchanski wrote:
> >>> The attached patch fixes erroneous quoting of the __LINE__ and __FILE__
> >>> macros in exception descriptions.
> >>
> >> Igor, do you have commit access to setup? If so, please apply this -
> >> it's approved.
> >
> > Rob,
> >
> > I don't have commit rights. Max, could you please do the honors?
> > Igor
>
> Not commiting. This patch causes compilation failiure on my machine.
> Example error:
> UserSettings.cc:66: error: syntax error before string constant
>
> BTW, unless I'm missing some subtlety on sources.redhat.com, you do appear
> to have commit access.
>
> Max.
Umm, what can I say except "Oops!"? Would you believe I redirected the
make output to one file, and looked at another? Bizarre, isn't it? I've
attached a (verified) working patch.
As for the commit rights, I do have them for some directories in the
cygwin-apps repository, but I was under the impression that those rights
were on a per-directory basis.
Igor
==============================================================================
2003-07-11 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* String++.h (TOSTRING): New macro.
* UserSettings.cc (UserSettings::deRegisterSetting): Fix
erroneous __LINE__/__FILE__ usage.
* download.cc (validateCachedPackage, check_for_cached): Ditto.
* geturl.cc (getUrlToStream): Ditto.
* install.cc (md5_one): Ditto.
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
-------------- next part --------------
Index: String++.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/String++.h,v
retrieving revision 2.11
diff -u -p -r2.11 String++.h
--- String++.h 23 Jun 2003 20:48:59 -0000 2.11
+++ String++.h 12 Jul 2003 00:47:14 -0000
@@ -106,5 +106,8 @@ String::size() const
{
return theData->length;
}
+
+#define __TOSTRING__(X) #X
+#define TOSTRING(X) __TOSTRING__(X)
#endif /* SETUP_STRING___H */
Index: UserSettings.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/UserSettings.cc,v
retrieving revision 2.3
diff -u -p -r2.3 UserSettings.cc
--- UserSettings.cc 16 Mar 2003 02:06:05 -0000 2.3
+++ UserSettings.cc 12 Jul 2003 00:47:14 -0000
@@ -63,6 +63,6 @@ UserSettings::deRegisterSetting(UserSett
{
Settings::iterator i = find(settings.begin(), settings.end(), &aSetting);
if (i == settings.end())
- throw new Exception ("__LINE__ __FILE__", String ("Attempt to deregister non registered setting!"), APPERR_LOGIC_ERROR);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Attempt to deregister non registered setting!"), APPERR_LOGIC_ERROR);
settings.erase(i);
}
Index: download.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/download.cc,v
retrieving revision 2.37
diff -u -p -r2.37 download.cc
--- download.cc 7 Apr 2003 12:46:55 -0000 2.37
+++ download.cc 12 Jul 2003 00:47:14 -0000
@@ -88,7 +88,7 @@ validateCachedPackage (String const &ful
}
delete thefile;
if (count < 0)
- throw new Exception ("__LINE__ __FILE__", String ("IO Error reading ") + pkgsource.Cached(), APPERR_IO_ERROR);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("IO Error reading ") + pkgsource.Cached(), APPERR_IO_ERROR);
md5_byte_t tempdigest[16];
md5_finish(&pns, tempdigest);
@@ -128,7 +128,7 @@ check_for_cached (packagesource & pkgsou
if (validateCachedPackage (prefix + pkgsource.Canonical (), pkgsource))
pkgsource.set_cached (prefix + pkgsource.Canonical ());
else
- throw new Exception ("__LINE__ __FILE__", String ("Package validation failure for ") + prefix + pkgsource.Canonical (), APPERR_CORRUPT_PACKAGE);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Package validation failure for ") + prefix + pkgsource.Canonical (), APPERR_CORRUPT_PACKAGE);
return 1;
}
@@ -146,7 +146,7 @@ check_for_cached (packagesource & pkgsou
if (validateCachedPackage (fullname, pkgsource))
pkgsource.set_cached (fullname );
else
- throw new Exception ("__LINE__ __FILE__", String ("Package validation failure for ") + fullname, APPERR_CORRUPT_PACKAGE);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Package validation failure for ") + fullname, APPERR_CORRUPT_PACKAGE);
return 1;
}
}
Index: geturl.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/geturl.cc,v
retrieving revision 2.21
diff -u -p -r2.21 geturl.cc
--- geturl.cc 12 May 2002 11:16:24 -0000 2.21
+++ geturl.cc 12 Jul 2003 00:47:14 -0000
@@ -125,7 +125,7 @@ getUrlToStream (String const &_url, HWND
{
delete n;
log (LOG_BABBLE) << "getUrlToStream failed!" << endLog;
- throw new Exception ("__LINE__ __FILE__", "Error opening url", APPERR_IO_ERROR);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, "Error opening url", APPERR_IO_ERROR);
}
if (n->file_size)
Index: install.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/install.cc,v
retrieving revision 2.61
diff -u -p -r2.61 install.cc
--- install.cc 25 Mar 2003 20:57:13 -0000 2.61
+++ install.cc 12 Jul 2003 00:47:14 -0000
@@ -658,7 +658,7 @@ void md5_one (const packagesource& sourc
// check the MD5 sum of the cached file here
io_stream *thefile = io_stream::open (source.Cached (), "rb");
if (!thefile)
- throw new Exception ("__LINE__ __FILE__", String ("IO Error opening ") + source.Cached(), APPERR_IO_ERROR);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("IO Error opening ") + source.Cached(), APPERR_IO_ERROR);
md5_state_t pns;
md5_init (&pns);
@@ -668,7 +668,7 @@ void md5_one (const packagesource& sourc
md5_append (&pns, buffer, count);
delete thefile;
if (count < 0)
- throw new Exception ("__LINE__ __FILE__", String ("IO Error reading ") + source.Cached(), APPERR_IO_ERROR);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("IO Error reading ") + source.Cached(), APPERR_IO_ERROR);
md5_byte_t tempdigest[16];
md5_finish(&pns, tempdigest);
@@ -678,6 +678,6 @@ void md5_one (const packagesource& sourc
log (LOG_BABBLE, String ("For file ") + source.Cached() + " ini digest is " + source.md5.print() + " file digest is " + tempMD5.print());
if (source.md5 != tempMD5)
- throw new Exception ("__LINE__ __FILE__", String ("Checksum failure for ") + source.Cached(), APPERR_CORRUPT_PACKAGE);
+ throw new Exception (TOSTRING(__LINE__) " " __FILE__, String ("Checksum failure for ") + source.Cached(), APPERR_CORRUPT_PACKAGE);
}
}
More information about the Cygwin-apps
mailing list