Ran ispell on Task_Parallelism_and_Synchronization.tex
Preliminary version of special functions proposal.
First update.
Merge branch 'master' into specAddSpecialFunctions
Distinguish C string utilities that return allocated strings from those that don't.

Some utilities that return a c_string return a string that has been freshly allocated off
the heap, while others to not.  To make the interface self-documenting, I created yet
another alias for "const char*" and called it c_string_copy.  To that one, I ascribed the
interpretation that it contains a freshly-allocated C string.  Thus:
```
  c_string foo();
    // Returns a pointer-copy of (i.e. a reference to) a C string owned by another program
    // entity.  The caller of foo() should not free the return value.
  c_string_copy bar();
    // Returns a freshly-allocated C string.  The caller should free the returned C string
    // (or arrange in some other way that it be cleaned up).
```
Since the C compiler treats the type aliases `c_string` and `c_string_copy` as equivalent,
a variable (or return value) of type `c_string_copy` can be supplied to a routine
expecting a `c_string` argument.

### DETAILS
####./runtime/include/chpl-mem.h
Piped the filename and linenumber arguments through, for better memory tracking.

####./runtime/include/chpl-string-support.h
Added the new typedef `c_string_copy` with comments explaining how it differs from c_string.
Updated return value types using `c_string_copy` where the returned string is
heap-allocated and should be managed by the caller.

####./runtime/include/chpl-string.h
Added comments to describe the interface to stringMove().
Updated the return type of remoteStringCopy, to say that it returns a heap-allocated c_string.

####./runtime/include/chplcast.{h,c}
Updated the interfaces to all integral_to_c_string() functions, to say that they return a
heap-allocated c_string result.
Added a comment to warn that this is not true for the boolean_to_c_string() functions.
Added comments to chpl_string_to_c_string and c_string_to_chpl_string, explaining why they
do not leak memory.

####./runtime/include/chplgmp.{h,c}
Changed the return type of chpl_gmp_mpz_get_str() to say that it returns a heap-allocated
c_string.

####./runtime/include/chplsys.{h,c}
Changed the return type of chpl_nodeName() to say that it returns a heap-allocated
c_string.

####./runtime/include/qio/qio_formatted.{h,c}
Changed the return type of qio_encode_to_string() to say that it returns a heap-allocated
c_string.

####./runtime/src/chpl-string-support.c
Changed the return type of chpl_format(), string_copy(), string_concat(), string_select()
and string_index() to say that they return a heap-allocated c_string.
Updated string_index to ensure that the returned c_string_copy can always be safely
deallocated.

####./runtime/src/chpl-string.c
Added comments about the semantics of stringMove().
Changed the return type of remoteStringCopy() to say that it returns a heap-allocated
c_string.

####./runtime/src/config.c
Added a comment about chpl_config_get_value() being inherently thread-safe.
Added tests of some compile-time computations.
Complete first draft of Special Functions chapter.
Add info for reviewers of outside developer commits.

Add the start of a section that talks about the responsibilities of
Chapel core team reviewers of outside developers' commits.

While here, fix a typo in a cross-ref.
Add the new release/1.10 branch dates to perf data files.
Add warning if compiling a configuration the runtime has not (yet) built.

This is useful when, for example, compiler and runtime was compiled with
CHPL_GMP=gmp (perhaps due to speculative build) but user has manually set
CHPL_GMP=none when calling chpl compiler.
Add new type c_string_copy to track owned c_strings.

Formerly, c_string was used to represent low-level C strings without regard to whether
they behave like fully-constructed (owned) objects or like references (unowned).  To
simplify the task of tracking allocations across the runtime/module interface, I added the
new type c_string_copy.

Now, c_string is used to represent unowned strings and c_string_copy is used to represent
owned strings.  To prevent memory leaks, an owned string should be freed before it goes
out of scope (or its ownership transferred to another program entity).  An unowned string
should not be feed.

When a c_string is used to initialize an object (such as a chpl_string)
that is expected to own its data, it must be copied into that object.  When a
c_string_copy is used to initialize such an object, a pointer copy will suffice.
Ownership of the c_string_copy is then transferred to the new object.

Note that a c_string_copy can be coerced to a c_string without breaking this ownership
invariant.  Ownership is retained by the original (c_string_copy) and not by the duplicate
(c_string).  This seems a good place to justify the naming: A c_string_copy is produced by
passing a c_string to the function string_copy().

[This version compiles and runs hello.chpl]

###DETAILS

####compiler/AST/expr.cpp
Moved all of the conversions between chpl_string, c_string and various fundamental types
from the PRIM_CAST clause of CallExpr::codegen() out to module code.
TODO: A PRIM_CAST returning an owned object should probably allocate that object.  This is
not a problem for fundamental types, but is probably a problem for c_string_copy,
chpl_string and records.  (Record casts are handled by compiler-generated cast functions
unless overridden.)

####compiler/AST/primitive.cpp
Added the new type info functions returnInfoStringCopy, and used this to inform the
compiler that the primitives
  string_concat
  string_index
  string_copy
  string_select
return c_string_copy objects.

####compiler/include/symbol.h
####compiler/AST/symbol.cpp
Added the new global initializer symbol gStringCopy.

####compiler/include/type.h
####compiler/AST/type.cpp
Added the new internal type dtStringCopy.
Added some comments suggesting future revisions.

####compiler/passes/resolveIntents.cpp
Added dtStringCopy to the list of types whose blank intent is equivalent to "const in".

####compiler/resolution/functionResolution.cpp
Added a coercion from c_string_copy to c_string.

####modules/internal/ChapelIO.chpl
Changed the return type of chpl_format() to c_string_copy.  These functions always
returned an owned c_string, and now we advertise that in the interface.

####modules/internal/String.chpl
Added an overload for toString() that takes a c_string_copy operand.  The new version
assumes ownership of the passed-in c_string_copy.  There were notations in the code that
we could use a non-allocating form of toString().  Now that task is accomplished.
Added the non-allocating versions of toString() -- taking a c_string_copy and returning a
chpl_string.
Added the c_string_copy to c_string cast used by the added coercion.

Removed the workaround for the string allocation bug in casts between c_strings and
chpl_string fixed before release, and replaced it with code that should not leak.
Some of the casts from fundamental types (e.g. enums and bools) to c_string yielded
an unowned c_string, while others yielded an owned c_string (i.e. a c_string_copy).  The
c_string cases had to be handled special w.r.t. the call to chpl_free_c_string().  Now,
copies are made of the c_string results, while the c_string_copy results are just usurped
buy the resulting chpl_string.

Added back the casts that used to be implemented by PRIM_CAST:
* bool to c_string
* integral to c_string_copy
* real to c_string_copy
* imag to c_string_copy

Revised c_string.substring() to always return a c_string_copy.  The ownership state of the
returned value used to be ambiguous, because if the range was empty it would return a
reference to a literal empty string (a c_string).

####modules/standard/GMP.chpl
chpl_gmp_mpz_get_str() now returns a c_string_copy.

####modules/standard/IO.chpl
qio_encode_to_string() now returns a c_string_copy.
The cast of an ioChar to a c_string now returns a c_string_copy.

####modules/standard/NewString.chpl
remoteStringCopy now returns a c_string_copy.

####runtime/include/chpl-string.h
Added string_from_c_string_copy() and wide_string_from_c_string_copy() to create a string
from a c_string_copy without allocating new memory.  Ownership of the c_string_copy
argument is transferred to the new string.

####runtime/include/chplcast.h
####runtime/src/chplcast.c
Replaced the individual int type to c_string functions with integral_to_c_string_copy().
Replaced the real and imag type to c_string functions with real_to_c_string_copy().

####runtime/include/chplsys.h
chpl_nodeName() actually returns a shared, statically-allocated string, so I changed its
return type to c_string from c_string_copy.

####runtime/src/chpl-string-support.c
Reworked string_select so it always returns a newly-allocated c_string_copy or NULL.

####runtime/src/chpl-string.c
Added string_from_c_string_copy().  This function steals the data owned by the passed-in
c_string_copy, so it creates a string from a c_string_copy without requiring a new
allocation and copy.  This is is used to implement the "non-allocating toString" mentioned
in several TODOs by Sung (which also allowed me to resolve those TODOs).

Added wide_string_from_c_string_copy(), which is the wide version of the above.

Reworked stringMove() so it always reuses the buffer provided.  The use of a zero-length
string to represent an empty c_string_copy is deprecated in favor of a null pointer.

####runtime/src/chplsys.c
Reworked chpl_nodeName() so it always returns an unowned c_string.
The thread safety of returning a shared object implies that it should be initialized only
once (pre node).  Although I don't guarantee that, it's pretty likely.
Using the assumption that the node name does not change in the course of execution of a
program, I moved the initialization inside the namespace==NULL test, so (in the absence of
races) it is, in fact, initialized only once.
If the node name is expected to change during a run, this routine would have to be
reworked using unshared data, and return a c_string_copy.
Add some missing casts to and from c_strings.

Removal from codegen of the conversion from c_strings to fundamental types means that they
had to be added as explicit casts in Strings.chpl.

This version passes all primers tests (local only).

###DETAILS

####/compiler/AST/primitive.cpp
The "string_copy" primitive actually returns a c_string_copy.

####/modules/internal/ChapelIO.chpl
Reworked StringWriter, so its state data is a c_string_copy, not a c_string.  This allows
us to make the calls to chpl_free_c_string() unconditional.

####/modules/internal/String.chpl
The cast to string type now also works if the source type is a c_string or a
c_string_copy, so I was able to remove the "x.type != c_string" exclusion.

I removed the "cast a string to types other than c_string, and enumerated the types to
which a string can be cast.

The casts from c_string to primitive types formerly performed in the codegen for PRIM_CAST
are now enumerated explicitly in module code.

The cast from complex to c_string_copy did not make it into the previous commit, so that
support is added here.

I needed to provide an implementation for _defaultOf(c_string_copy).  It returns a
_nullString, which is effectively "(const char*) NULL".

I needed to provide definitions of assignment from c_string to c_string_copy and
c_string_copy to c_string_copy.

I needed to supply a cast from a chpl_string to a c_string_copy.  This creates a
newly-allocated copy.

I needed to provide a cast from boolean types to c_string_copy.

I had to supply a return type for the real_to_c_string_copy() extern prototype.

####/modules/standard/IO.chpl
I needed to add a cast from ioNewline and ioLiteral to c_string_copy.

####/runtime/include/chplcast.h
####/runtime/src/chplcast.c
Removed the older implementation of the integral_to_c_string and real_to_c_string functions.
Adjusted indentation in real_to_c_string_copy().
Fix Coverity issue 1212346

Coverity was (I believe) correctly complaining about a possible null
dereference during generic resolution.  I looked through the filterCandidates
call heirarchy and it struck me as possible (though very unlikely) for a
control flow to reach that point when best was non-null but best->fn was.  To
fix, I added a check to best->fn to ensure it was non-null before the access
was performed.
Some tweaks after first paratest run.

Now the result of a cast of any type to a string-ish thing is c_string_copy.  Adjusted the
memory management in that routine and also in string.write and c_string.write routines.

Made the coercion cast from c_string_copy to c_string return the right type.
Added a writeThis() method for c_string_copy.

Down to 401 failures (std).
Merge branch 'master' of github.com:chapel-lang/chapel into check-runtime-gen-path
Update runtime lib dir check based on review feedback.

* Fixes the if statement to use all make functions, instead of a combination of
  bash and make.
* Promotes the warning to an error.
* Updates the message to be more clear about the issue.
Add additional messaging when CHPL_DEVELOPER is set.

Also update FIXME comment.
Add a comment to the change.

Tom pointed out that this extra check probably means we should restructure
resolveNormalCall.  This isn't a high priority for me, but it seems good to
note, so I added a note.
Merge branch 'master' into coverity1212346
Skip new pidigits tests if gmp == none.