Changeset 879eaa7 in rtems-libbsd


Ignore:
Timestamp:
Jun 13, 2018, 1:04:47 PM (10 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
647dd08ae2aa69b935c2847ea450fb824322ecae, c6261f97870562d4c797cfb1ff1ba0affb85a916
Children:
01855a5
Parents:
9ea8664
git-author:
Christian Mauderer <christian.mauderer@…> (06/13/18 13:04:47)
git-committer:
Christian Mauderer <christian.mauderer@…> (08/01/18 07:55:27)
Message:

userspace-header-gen: Special case for Yacc / Lex.

Some variables generated by Yacc / Lex need a special treatment. That
had been done by manual editing of the generated headers in the past.
This patch integrate these changes into the generator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • userspace-header-gen.py

    r9ea8664 r879eaa7  
    8282        self._rtems_port_names.append("rtems_bsd_command_%s" % progname)
    8383
     84        self._filter_special_vars = []
     85        # Take some special care for some yacc variables. This matches the yyval
     86        # and yylval. These two always make trouble in the generated headers.
     87        # yyval is initialized by Yacc generated code so it's not
     88        # necessary to move them into the copy back region. yylval is used only
     89        # for transporting a value. It will be set when used.
     90        self._filter_special_vars.append({
     91            "re":re.compile('extern YYSTYPE .*val'),
     92            "reason":"Lex / Yacc variable initialized by generated code",
     93            "action":"no_section"
     94            })
     95        # Lex generates an external variable that shouldn't be extern. Move it
     96        # to the current data header file.
     97        self._filter_special_vars.append({
     98            "re":re.compile('extern yy_size_t .*len'),
     99            "reason":"Lex adds an extern to this variable that is not necessary.",
     100            "action":"ignore_extern"
     101            })
     102
    84103        self._err = err
    85104        self._verbose = verbose
     
    382401                    outfile = glob_data_out
    383402
     403                for flt in self._filter_special_vars:
     404                    if flt["re"].match(var_with_type) is not None:
     405                        if flt["action"] == "no_section":
     406                            self._err.write('Don\'t put "%s" into section. Reason: %s.\n' % \
     407                                            (var_with_type, flt["reason"]))
     408                            outfile = None
     409                        if flt["action"] == "ignore_extern":
     410                            self._err.write('Ignore extern of variable "%s". Reason: %s.\n' % \
     411                                            (var_with_type, flt["reason"]))
     412                            outfile = data_out
     413
    384414            # write output
    385415            if self._verbose >= VERBOSE_SOME:
     
    390420                    self._err.write('Found a function "%s" at %s (DIE offset %s); extern: %r\n' % \
    391421                                    (varname, var_decl, child.offset, is_extern))
    392             if not is_function:
     422            if (not is_function) and (outfile is not None):
    393423                outfile.write("RTEMS_LINKER_RWSET_CONTENT(bsd_prog_%s, %s);\n" % \
    394424                        (self._progname, var_with_type))
Note: See TracChangeset for help on using the changeset viewer.