mbeckerle commented on a change in pull request #545:
URL: https://github.com/apache/daffodil/pull/545#discussion_r623398233
##########
File path: BUILD.md
##########
@@ -31,26 +31,32 @@ the latest [SBT] version following their websites'
instructions or
install them using your operating system's package manager.
Since Daffodil now has a C backend as well as a Scala backend, you
-will need a C compiler supporting the [C99] standard or later, the
-[Mini-XML] library, and possibly the GNU [argp] library if your
-system's C library doesn't include it already. You can install either
-[gcc] or [clang] using your operating system's package manager. If
-you can't install the [Mini-XML] library using your operating system's
-package manager, you'll have to build it from source. We'll tell you
-how to do that on Windows but the commands should work on other
-operating systems too.
-
-You can set your environment variables "CC" and "AR" to the correct
+will need a C compiler supporting the [C99] standard or later and the
+[Mini-XML] library. You can install either [gcc] or [clang] using
+your operating system's package manager. If you can't install the
+[Mini-XML] library using your operating system's package manager,
+you'll have to build it from source. We'll tell you how to do that on
+Windows but the commands should work on other operating systems too.
+
+You can set your environment variables `CC` and `AR` to the correct
commands (or set them to `true` to disable C compilation altogether)
if you don't want `sbt compile` to call your C compiler with `cc` and
`ar` as the default commands.
-## Fedora 33
+## Fedora 34
-You can use the `dnf` package manager to install most of the build
-requirements needed to build Daffodil:
+You can use the `dnf` package manager to install most of the tools
+needed to build Daffodil:
- sudo dnf install gcc git java-11-openjdk-devel make mxml-devel pkgconf
+ sudo dnf install clang git java-11-openjdk-devel llvm make mxml-devel
pkgconf
+
+If you want to use clang instead of gcc, you'll have to set your
Review comment:
You set it up so it is clang by default now? So is this instruction
correct still, or does it have these settings now, and you have to flip them to
use gcc now?
##########
File path:
daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/errors.c
##########
@@ -17,34 +17,109 @@
#include "errors.h"
#include <assert.h> // for assert
-#include <error.h> // for error
#include <inttypes.h> // for PRId64
#include <stdbool.h> // for bool, false, true
-#include <stdio.h> // for NULL, feof, ferror, FILE, size_t
-#include <stdlib.h> // for EXIT_FAILURE
+#include <stdio.h> // for fprintf, stderr, NULL, feof, ferror, FILE,
size_t, stdout
+#include <stdlib.h> // for exit, EXIT_FAILURE
-// error_message - return an internationalized error message
+// eof_or_error - get pointer to error if stream has eof or error indicator set
+
+const Error *
+eof_or_error(FILE *stream)
+{
+ if (feof(stream))
+ {
+ static Error error = {ERR_STREAM_EOF, {NULL}};
+ return &error;
+ }
+ else if (ferror(stream))
+ {
+ static Error error = {ERR_STREAM_ERROR, {NULL}};
+ return &error;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+// get_diagnostics - get pointer to validation diagnostics
+
+Diagnostics *
+get_diagnostics(void)
+{
+ static Diagnostics diagnostics;
+ return &diagnostics;
+}
+
+// add_diagnostic - add a new error to validation diagnostics
+
+bool
+add_diagnostic(Diagnostics *diagnostics, const Error *error)
+{
+ if (diagnostics && error)
+ {
+ if (diagnostics->length < LIMIT_DIAGNOSTICS)
+ {
+ Error *err = &diagnostics->array[diagnostics->length++];
+ err->code = error->code;
+ err->s = error->s;
+ return true;
+ }
+ }
+ return false;
+}
+
+// error_message - get an internationalized error message
static const char *
error_message(enum ErrorCode code)
Review comment:
Feels like this should be in a CLI-oriented file, since it's giving
CLI-help.
##########
File path: BUILD.md
##########
@@ -82,10 +96,18 @@ Install [MSYS2] following its website's instructions and
open a new
"MSYS2 MSYS" window. We'll need its collection of free programs and
libraries.
-Install [gcc] and [libargp][argp] using MSYS2's `pacman` package
-manager:
+You can use the `pacman` package manager to install most of the tools
+needed to build Daffodil:
+
+ pacman -S clang diffutils git make pkgconf
+
+If you want to use clang instead of gcc, you'll have to set your
+environment variables `CC` and `AR` to the clang binaries' names:
Review comment:
and here
##########
File path: BUILD.md
##########
@@ -61,10 +67,18 @@ commands you type will be able to call the C compiler.
## Ubuntu 20.04
-You can use the `apt` package manager to install most of the build
-requirements needed to build Daffodil:
+You can use the `apt` package manager to install most of the tools
+needed to build Daffodil:
+
+ sudo apt install build-essential clang-10 clang-format-10 default-jdk git
libmxml-dev
- sudo apt install build-essential default-jdk git libmxml-dev
+If you want to use clang instead of gcc, you'll have to set your
Review comment:
ditto here. Ithought this was the default now.
##########
File path:
daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/daffodil_main.c
##########
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-#include <stdio.h> // for NULL, perror, FILE, fclose, fflush, fopen,
stdin, stdout
-#include <string.h> // for strcmp
-#include "daffodil_argp.h" // for daffodil_parse, daffodil_parse_cli,
daffodil_unparse, daffodil_unparse_cli, daffodil_cli, parse_daffodil_cli,
DAFFODIL_PARSE, DAFFODIL_UNPARSE
-#include "errors.h" // for continue_or_exit, Error, print_diagnostics,
PState, UState, ERR_FILE_CLOSE, ERR_FILE_FLUSH, ERR_FILE_OPEN,
ERR_INFOSET_READ, ERR_INFOSET_WRITE
-#include "infoset.h" // for walkInfoset, InfosetBase, rootElement, ERD,
VisitEventHandler
-#include "xml_reader.h" // for xmlReaderMethods, XMLReader
-#include "xml_writer.h" // for xmlWriterMethods, XMLWriter
+#include <stdio.h> // for NULL, FILE, perror, fclose, fopen, stdin,
stdout
+#include <string.h> // for strcmp
+#include "daffodil_getopt.h" // for daffodil_cli, parse_daffodil_cli,
daffodil_parse, daffodil_parse_cli, daffodil_unparse, daffodil_unparse_cli,
DAFFODIL_PARSE, DAFFODIL_UNPARSE
Review comment:
Line too long
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]