Re: [gccsdk] exec() possibly a problem

2015-02-06 Thread Ralph Corderoy
Hi Ron,

 My useage here is in fact wrong, it appears that command and args are
 wrapped in single quotes for a subshell. (Also done in a shellscript)

No, that's too simplistic.  Unix shells like dash follow
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
in their processing of the backslash escape, and single and double
quotes.

 $ $PATH/sh -c 'printf hello...\\n'
 hello...
 $
 all good
 Simplifies things, now just the \\n being needed across the new
 process.

I've only skimmed this thread to date, but be aware that there are three
processes parsing that command above.  The dash shell that's printed the
`$ ' prompt.  The sh you explicitly start.  And the printf that's either
a built-in to the shell or a separate executable that's processing the
argv[] its main has been passed.  All three of them are happy to
interpret a backslash-escape in some circumstances.

As an example, double quotes, which allow more interpolating, aren't
necessary above.  Another layer of single quotes can be used, with them
mechanically being escaped, e.g.

$ sh -c 'printf '\''hello...\n'\'
hello...
$ 

Cheers, Ralph.

___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK


Re: [gccsdk] GCC: bits/c++config.h

2015-02-06 Thread Duncan Moore


On 06/02/2015 07:34, WPB wrote:

I'm currently hitting an error when creating the dependencies file:

Fatal error: bits/c++config.h: No such file or directory

And it's true, when I look inside !GCC in include.c++.4/7/4.bits.h, I can
see no such file. There's c++0x_warning, but that's the closest. Is this
an omission from the 4.7.4 distribution?


You say the error is when creating dependency files. I assume it's OK if 
you're not using dependency files?
I think this is an internal header file, so this looks like it could 
possibly be a bug in the gcc dependency logic (not RISC OS specific), 
although this would be a bit surprising.


Fortunately you don't need standard header files in dependency files 
anyway. Seeing as they don't change, all they do is slow 'make' down.


I use: -MMD -MP

-MMD stops system header files, and writes the dependency files to *.d.
I think it might be -MM to just stop the system header files.
(I just put 'd' in the sfix list, and then all my dependency files get 
conveniently hidden away in a directory 'd').


-MP is worth having, as it avoids some problems with dependency files.

This is all explained in the gcc manual., and is worth looking at. 
That's in !GCC.docs.gcc. But I normally just google for 'gcc manual'.



Also, as the source I'm trying to compile is in Unix directory layout
(no c, h subdirectories, etc., just everything in one flat src
directory),


I've never tried that myself. I think it works, but I'm not 100% certain.


  I've figured out that I have to do:

Set UnixEnv$cc1plus$sfix 

What tripped me up, was that the command to invoke the C++ compiler in my
makefile is g++. So I initially tried:

Set UnixEnv$g++$sfix 

But that didn't work. Can anyone explain to me the difference between the
g++ and cc1plus commands?


I think g++ calls cc1plus. I think you'll be better off setting all the 
gcc commands to have the same suffix list, otherwise inconsistencies 
might arise. They are set in !GCC.!Run.



Finally, if there's somewhere the whole UnixEnv$* environment variable
thing is documented, I'd love to know about it. I could find much info in
the !GCC help file. Everything I know about it now (not much!) is from
Duncan's 'make' help file.


There's some documentation in !GCC.docs.libunixlib.README.
It might be worthwhile 'grep'ing through the whole of the docs directory.
You might possibly find something in pages linked from 
http://www.riscos.info/index.php/GCCSDK. Even if it's not there, there's 
lots of other useful information.


Duncan

___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK


Re: [gccsdk] GCC: bits/c++config.h

2015-02-06 Thread Lee Noar

On 06/02/15 07:34, WPB wrote:

Can anyone explain to me the difference between the g++ and cc1plus
commands?


cc1plus is the C++ compiler. g++ is the driver. It's the job of g++
to drive the whole build process. First it may call the pre-processor
(although I think that's integrated into the compiler now), then
it calls the compiler (cc1plus) to convert the pre-processed source
code into assembler, then it calls the assembler (GAS) to convert the
assembler into a machine code object file, finally it calls the linker
(LD) to combine all the object files and libraries into an executable.

So g++/gcc is the program that manages all the various stages of
compilation, cc1plus is one of those stages.

Lee.


___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK