www.digitalmars.com         C & C++   DMDScript  

c++ - Bug: sc.ini CFLAGS=fileName

reply Marshall <MrMarshallMan at yahoo dot com> <Marshall_member pathlink.com> writes:
Description: In \dm\bin\sc.ini, CFLAGS=fileName reads fileName as a seperate
source file and compiles it.

How to replicate:

1. Set CFLAGS in sc.ini to CFLAGS="% P%\cflags.ini"
2. Create test files cflags.ini and test.cpp.  See below.
3. dmc test.cpp

***** BEGIN cfiles.ini *****
"-DSHOW_MESSAGE"
***** END cfiles.ini *****

***** BEGIN test.cpp *****
#ifndef SHOW_MESSAGE
#   error SHOW_MESSAGE was not defined.
#endif
int main( void ) {return 0;}
***** END test.cpp *****

Expected results: The fileName used with CFLAGS should be opened and read for
additional compiler switches.  The following is a working example of what was
expected.  See \dm\html\ctg\sc.html#searches

1. Remove the CFLAGS line from sc.ini
2. dmc  "\dm\bin\cflags.ini" test.cpp


OS: XP w/ sp 2
Compiler: Digital Mars CD v 8.42, with cd843.zip

Apologia if this turns out to be user misunderstanding.
May 13 2005
parent reply "Walter" <newshound digitalmars.com> writes:
Actually, that's how it's supposed to work. CFLAGS is inserted into the
command line and parsed exactly as if it was typed on the command line.
May 13 2005
parent reply Marshall <Marshall_member pathlink.com> writes:
OK, I'm unclear on CFLAGS.  Fair enough.  BTW Walter, thank you for the
clerification.

So, how would a user get the following command to work using sc.ini's CFLAGS?

dmc  "\dm\bin\cflags.ini" test.cpp

I have tried CFLAGS= \dm\bin\cflags.ini
Which fails during scppn.exe as "command line error: no input file specified"

and CFLAGS=\dm\bin\cflags.ini
Doesn't work as I assumed.  I.e. It's pulling in scflags.ini as a source file to
be compiled.

I think my confusion originated with \dm\html\ctg\sc.html#searches 
which states "If it is set, it behaves as if the first argument to DMC is
 CFLAGS."

An example of what I am tyrying to do can be seen at:
c++/4627

In article <d63p59$a8k$1 digitaldaemon.com>, Walter says...
Actually, that's how it's supposed to work. CFLAGS is inserted into the
command line and parsed exactly as if it was typed on the command line.

Thank you, Marshall MrMarshallMan at yahoo dot com
May 19 2005
parent "Walter" <newshound digitalmars.com> writes:
"Marshall" <Marshall_member pathlink.com> wrote in message
news:d6igfn$2655$1 digitaldaemon.com...
 OK, I'm unclear on CFLAGS.  Fair enough.  BTW Walter, thank you for the
 clerification.

 So, how would a user get the following command to work using sc.ini's

 dmc  "\dm\bin\cflags.ini" test.cpp

 I have tried CFLAGS= \dm\bin\cflags.ini
 Which fails during scppn.exe as "command line error: no input file

 and CFLAGS=\dm\bin\cflags.ini
 Doesn't work as I assumed.  I.e. It's pulling in scflags.ini as a source

 be compiled.

 I think my confusion originated with \dm\html\ctg\sc.html#searches
 which states "If it is set, it behaves as if the first argument to DMC is
  CFLAGS."

It currently doesn't rescan the environment variable text for includes, which is the source of the difficulty you're having.
May 20 2005