chapel-lang/chapel — pull request #782 by bradcray (2014-11-08 01:23:50+00:00)
Title: Fix prgenv-cray portability issue for glob() call

The glob() call takes an optional function pointer as an argument, and
I had just been passing c_nil into it. However, the Cray compiler
doesn't like this because of the fact that it isn't a literal "NULL"
being passed in, but a Chapel variable of type void* which isn't
of pointer-to-function type.

As an easy workaround for this, I invented an external type to
represent the function pointer type and declared a (local to the
scope in question) extern var named NULL of that type. This has
the effect of passing the NULL straight through to glob() which
makes the complaint go away.

If this didn't work on some other platform (though I believe it
will), we could always push the glob() into the runtime, wrapping
it as chpl_glob() and have it supply the NULL argument for the
function pointer. But the current approach feels more lightweight
without seeming crufty to me.