This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: ObjC++-related common code mods



On 17 Aug 2004, at 17.04, Zack Weinberg wrote:


Ziemowit Laski <zlaski@apple.com> writes:

Ok; how should I handle "objc/objc-act.h" further down in the patch?

I'm not sure I understand. Having a slash in the pathname embedded in
gengtype.c should be fine - all supported operating systems understand
/ as a path separator; it's just that gengtype might get input with \
as the path separator, on Windows.

But if you can see a '\\', then you could plausibly also see 'c:\\...\\objc\\objc-act.c', no?

Sure. Everywhere you _check for_ a directory separator, should be using IS_DIR_SEPARATOR so that it properly handles \ on Windows. But pathnames embedded in the program can unconditionally use /. (it'd be okay, for instance, to produce C:\...\objc/objc-act.h - weird as that looks to a human, the Windows kernel will be perfectly happy with it.)

Going back to my patch,


+  else if (strcmp (basename, "objc/objc-act.h") == 0)
+    output_name = "gt-objc-objc-act.h", for_name = "objc/objc-act.c";

the fragment _checks_ the 'basename' variable, which is an input to
gengtype.  (On the other hand, 'for_name' does not get compared against
input and can safely contain '/' as you suggest.)

Unless, of course, you can't really have 'c:\\...\\objc\\objc-act.c',
but (at worst) 'c:\\...\\objc/objc-act.c' (with the 'objc/objc-act.c'
snarfed from one of the config-lang.in files rather than the host OS).
Is that the case?

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]