Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl2/dtc/dist Merge conflicts



details:   https://anonhg.NetBSD.org/src/rev/74a6926a99ba
branches:  trunk
changeset: 824543:74a6926a99ba
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Jun 08 16:00:40 2017 +0000

description:
Merge conflicts

diffstat:

 external/gpl2/dtc/dist/.gitignore                 |    17 -
 external/gpl2/dtc/dist/.travis.yml                |     5 -
 external/gpl2/dtc/dist/data.c                     |    18 +-
 external/gpl2/dtc/dist/dtc-lexer.l                |    65 +-
 external/gpl2/dtc/dist/dtc-parser.y               |    62 +-
 external/gpl2/dtc/dist/dtc.h                      |    47 +-
 external/gpl2/dtc/dist/fdtdump.c                  |    39 +-
 external/gpl2/dtc/dist/fdtput.c                   |    13 +-
 external/gpl2/dtc/dist/flattree.c                 |   105 +-
 external/gpl2/dtc/dist/libfdt/Makefile.libfdt     |    11 -
 external/gpl2/dtc/dist/libfdt/TODO                |     3 -
 external/gpl2/dtc/dist/libfdt/fdt.c               |   250 ---
 external/gpl2/dtc/dist/libfdt/fdt.h               |   111 -
 external/gpl2/dtc/dist/libfdt/fdt_addresses.c     |    96 -
 external/gpl2/dtc/dist/libfdt/fdt_empty_tree.c    |    84 -
 external/gpl2/dtc/dist/libfdt/fdt_ro.c            |   679 --------
 external/gpl2/dtc/dist/libfdt/fdt_rw.c            |   494 ------
 external/gpl2/dtc/dist/libfdt/fdt_strerror.c      |    96 -
 external/gpl2/dtc/dist/libfdt/fdt_sw.c            |   288 ---
 external/gpl2/dtc/dist/libfdt/fdt_wip.c           |   118 -
 external/gpl2/dtc/dist/libfdt/libfdt.h            |  1653 ---------------------
 external/gpl2/dtc/dist/libfdt/libfdt_env.h        |   111 -
 external/gpl2/dtc/dist/libfdt/libfdt_internal.h   |    95 -
 external/gpl2/dtc/dist/libfdt/version.lds         |    67 -
 external/gpl2/dtc/dist/srcpos.c                   |    39 +-
 external/gpl2/dtc/dist/tests/mangle-layout.c      |     2 +
 external/gpl2/dtc/dist/tests/move_and_save.c      |     2 +
 external/gpl2/dtc/dist/tests/test_tree1_body.dtsi |    43 -
 external/gpl2/dtc/dist/tests/tests.h              |     8 +-
 external/gpl2/dtc/dist/util.h                     |    25 +-
 30 files changed, 270 insertions(+), 4376 deletions(-)

diffs (truncated from 5310 to 300 lines):

diff -r 24eaf029cae0 -r 74a6926a99ba external/gpl2/dtc/dist/.gitignore
--- a/external/gpl2/dtc/dist/.gitignore Thu Jun 08 15:59:45 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-*.o
-*.d
-*.a
-*.patch
-*.so
-*~
-*.tab.[ch]
-lex.yy.c
-*.lex.c
-/dtc
-/fdtdump
-/convert-dtsv0
-/version_gen.h
-/fdtget
-/fdtput
-/patches
-/.pc
diff -r 24eaf029cae0 -r 74a6926a99ba external/gpl2/dtc/dist/.travis.yml
--- a/external/gpl2/dtc/dist/.travis.yml        Thu Jun 08 15:59:45 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-language: c
-
-script:
-        - make
-        - make check
diff -r 24eaf029cae0 -r 74a6926a99ba external/gpl2/dtc/dist/data.c
--- a/external/gpl2/dtc/dist/data.c     Thu Jun 08 15:59:45 2017 +0000
+++ b/external/gpl2/dtc/dist/data.c     Thu Jun 08 16:00:40 2017 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: data.c,v 1.3 2017/06/08 16:00:40 skrll Exp $   */
+
 /*
  * (C) Copyright David Gibson <dwg%au1.ibm.com@localhost>, IBM Corporation.  2005.
  *
@@ -171,9 +173,9 @@
 struct data data_append_integer(struct data d, uint64_t value, int bits)
 {
        uint8_t value_8;
-       uint16_t value_16;
-       uint32_t value_32;
-       uint64_t value_64;
+       fdt16_t value_16;
+       fdt32_t value_32;
+       fdt64_t value_64;
 
        switch (bits) {
        case 8:
@@ -197,14 +199,14 @@
        }
 }
 
-struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
+struct data data_append_re(struct data d, uint64_t address, uint64_t size)
 {
-       struct fdt_reserve_entry bere;
+       struct fdt_reserve_entry re;
 
-       bere.address = cpu_to_fdt64(re->address);
-       bere.size = cpu_to_fdt64(re->size);
+       re.address = cpu_to_fdt64(address);
+       re.size = cpu_to_fdt64(size);
 
-       return data_append_data(d, &bere, sizeof(bere));
+       return data_append_data(d, &re, sizeof(re));
 }
 
 struct data data_append_cell(struct data d, cell_t word)
diff -r 24eaf029cae0 -r 74a6926a99ba external/gpl2/dtc/dist/dtc-lexer.l
--- a/external/gpl2/dtc/dist/dtc-lexer.l        Thu Jun 08 15:59:45 2017 +0000
+++ b/external/gpl2/dtc/dist/dtc-lexer.l        Thu Jun 08 16:00:40 2017 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: dtc-lexer.l,v 1.3 2017/06/08 16:00:40 skrll Exp $      */
+
 /*
  * (C) Copyright David Gibson <dwg%au1.ibm.com@localhost>, IBM Corporation.  2005.
  *
@@ -62,7 +64,8 @@
 
 static void push_input_file(const char *filename);
 static bool pop_input_file(void);
-static void lexical_error(const char *fmt, ...);
+static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
+
 %}
 
 %%
@@ -73,24 +76,32 @@
                }
 
 <*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? {
-                       char *line, *tmp, *fn;
+                       char *line, *fnstart, *fnend;
+                       struct data fn;
                        /* skip text before line # */
                        line = yytext;
                        while (!isdigit((unsigned char)*line))
                                line++;
-                       /* skip digits in line # */
-                       tmp = line;
-                       while (!isspace((unsigned char)*tmp))
-                               tmp++;
-                       /* "NULL"-terminate line # */
-                       *tmp = '\0';
-                       /* start of filename */
-                       fn = strchr(tmp + 1, '"') + 1;
-                       /* strip trailing " from filename */
-                       tmp = strchr(fn, '"');
-                       *tmp = 0;
+
+                       /* regexp ensures that first and list "
+                        * in the whole yytext are those at
+                        * beginning and end of the filename string */
+                       fnstart = memchr(yytext, '"', yyleng);
+                       for (fnend = yytext + yyleng - 1;
+                            *fnend != '"'; fnend--)
+                               ;
+                       assert(fnstart && fnend && (fnend > fnstart));
+
+                       fn = data_copy_escape_string(fnstart + 1,
+                                                    fnend - fnstart - 1);
+
+                       /* Don't allow nuls in filenames */
+                       if (memchr(fn.val, '\0', fn.len - 1))
+                               lexical_error("nul in line number directive");
+
                        /* -1 since #line is the number of the next line */
-                       srcpos_set_line(xstrdup(fn), atoi(line) - 1);
+                       srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
+                       data_free(fn);
                }
 
 <*><<EOF>>             {
@@ -113,6 +124,11 @@
                        return DT_V1;
                }
 
+<*>"/plugin/"  {
+                       DPRINT("Keyword: /plugin/\n");
+                       return DT_PLUGIN;
+               }
+
 <*>"/memreserve/"      {
                        DPRINT("Keyword: /memreserve/\n");
                        BEGIN_DEFAULT();
@@ -153,7 +169,10 @@
                        errno = 0;
                        yylval.integer = strtoull(yytext, &e, 0);
 
-                       assert(!(*e) || !e[strspn(e, "UL")]);
+                       if (*e && e[strspn(e, "UL")]) {
+                               lexical_error("Bad integer literal '%s'",
+                                             yytext);
+                       }
 
                        if (errno == ERANGE)
                                lexical_error("Integer literal '%s' out of range",
@@ -173,16 +192,16 @@
                        if (d.len == 1) {
                                lexical_error("Empty character literal");
                                yylval.integer = 0;
-                               return DT_CHAR_LITERAL;
+                       } else {
+                               yylval.integer = (unsigned char)d.val[0];
+
+                               if (d.len > 2)
+                                       lexical_error("Character literal has %d"
+                                                     " characters instead of 1",
+                                                     d.len - 1);
                        }
 
-                       yylval.integer = (unsigned char)d.val[0];
-
-                       if (d.len > 2)
-                               lexical_error("Character literal has %d"
-                                             " characters instead of 1",
-                                             d.len - 1);
-
+                       data_free(d);
                        return DT_CHAR_LITERAL;
                }
 
diff -r 24eaf029cae0 -r 74a6926a99ba external/gpl2/dtc/dist/dtc-parser.y
--- a/external/gpl2/dtc/dist/dtc-parser.y       Thu Jun 08 15:59:45 2017 +0000
+++ b/external/gpl2/dtc/dist/dtc-parser.y       Thu Jun 08 16:00:40 2017 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: dtc-parser.y,v 1.3 2017/06/08 16:00:40 skrll Exp $     */
+
 /*
  * (C) Copyright David Gibson <dwg%au1.ibm.com@localhost>, IBM Corporation.  2005.
  *
@@ -19,6 +21,7 @@
  */
 %{
 #include <stdio.h>
+#include <inttypes.h>
 
 #include "dtc.h"
 #include "srcpos.h"
@@ -35,7 +38,7 @@
                treesource_error = true; \
        } while (0)
 
-extern struct boot_info *the_boot_info;
+extern struct dt_info *parser_output;
 extern bool treesource_error;
 %}
 
@@ -56,9 +59,11 @@
        struct node *nodelist;
        struct reserve_info *re;
        uint64_t integer;
+       unsigned int flags;
 }
 
 %token DT_V1
+%token DT_PLUGIN
 %token DT_MEMRESERVE
 %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
 %token DT_BITS
@@ -75,6 +80,8 @@
 
 %type <data> propdata
 %type <data> propdataprefix
+%type <flags> header
+%type <flags> headers
 %type <re> memreserve
 %type <re> memreserves
 %type <array> arrayprefix
@@ -105,10 +112,31 @@
 %%
 
 sourcefile:
-         DT_V1 ';' memreserves devicetree
+         headers memreserves devicetree
+               {
+                       parser_output = build_dt_info($1, $2, $3,
+                                                     guess_boot_cpuid($3));
+               }
+       ;
+
+header:
+         DT_V1 ';'
                {
-                       the_boot_info = build_boot_info($3, $4,
-                                                       guess_boot_cpuid($4));
+                       $$ = DTSF_V1;
+               }
+       | DT_V1 ';' DT_PLUGIN ';'
+               {
+                       $$ = DTSF_V1 | DTSF_PLUGIN;
+               }
+       ;
+
+headers:
+         header
+       | header headers
+               {
+                       if ($2 != $1)
+                               ERROR(&@2, "Header flags don't match earlier ones");
+                       $$ = $1;
                }
        ;
 
@@ -149,10 +177,10 @@
                {
                        struct node *target = get_node_by_ref($1, $3);
 
-                       add_label(&target->labels, $2);
-                       if (target)
+                       if (target) {
+                               add_label(&target->labels, $2);
                                merge_nodes(target, $4);
-                       else
+                       } else
                                ERROR(&@3, "Label or path %s not found", $3);
                        $$ = $1;
                }
@@ -414,8 +442,24 @@
 
 integer_mul:
          integer_mul '*' integer_unary { $$ = $1 * $3; }
-       | integer_mul '/' integer_unary { $$ = $1 / $3; }
-       | integer_mul '%' integer_unary { $$ = $1 % $3; }
+       | integer_mul '/' integer_unary
+               {
+                       if ($3 != 0) {
+                               $$ = $1 / $3;
+                       } else {
+                               ERROR(&@$, "Division by zero");
+                               $$ = 0;
+                       }
+               }
+       | integer_mul '%' integer_unary
+               {
+                       if ($3 != 0) {



Home | Main Index | Thread Index | Old Index