History log of /external/dtc/srcpos.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
00d7bb1f4b0e3578c69c126fa6c50a7897c4524f 08-Feb-2017 David Gibson <david@gibson.dropbear.id.au> dtc: pos parameter to srcpos_string() can't be NULL

None of the callers ever pass a NULL to srcpos_string(), so the check
for it is not necessary. Furthermore, checking it make Coverity complain
about the raw dereferences which follow later in the function.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
44a59713cf0518382cb8fe705f59fd974a1ac030 12-Jul-2016 David Gibson <david@gibson.dropbear.id.au> Remove unused srcpos_dump() function

srcpos_dump() has no current users, and I have no plans to use it. So
remove it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
d71d25d76012896521f937bf0c69f27b1a37cdc2 25-May-2016 David Gibson <david@gibson.dropbear.id.au> Use xasprintf() in srcpos

Now that we have an xasprintf() helper function, use it to simplify the
srcpos_string() implementation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
83e606a64d7b555bea3c3007b48bb9f790f0139c 19-Jun-2014 Andrei Errapart <andrei@errapartengineering.com> Open binary files in binary mode

The "b" flag to fopen() is generally a no-op on Unix-like systems, but may
be important on other systems, including Windows.

Signed-off-by: Andrei Errapart <andrei@errapartengineering.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
6d889343710e0ecb14f87758608708e08df7c8c1 25-Jan-2014 Florian Fainelli <f.fainelli@gmail.com> dtc: avoid shadowing dirname()

dirname() is declared as a function, and later on try_open() another
variable dirname is used, which shadows the dirname() function
declaration and will produce the following warnings/errors with
-Wshadow turned on:

srcpos.c: In function 'try_open':
srcpos.c:71:35: error: declaration of 'dirname' shadows a global
declaration [-Werror=shadow]
srcpos.c:37:14: error: shadowed declaration is here [-Werror=shadow]
srcpos.c: In function 'srcfile_add_search_path':
srcpos.c:183:42: error: declaration of 'dirname' shadows a global
declaration [-Werror=shadow]
srcpos.c:37:14: error: shadowed declaration is here [-Werror=shadow]
cc1: all warnings being treated as errors

Fix this by renaming the function dirname() to get_dirname().

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
/external/dtc/srcpos.c
0e2d3992258ff4129a8c0f79b660e92994411684 01-Jan-2014 David Gibson <david@gibson.dropbear.id.au> Make srcpos_{v,}error() more widely useful

Allow them to take a prefix argument giving the general type of error,
which will be useful in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
0c0bf8519aab878acb864d84185bd2395b1e3d5b 01-Jan-2014 David Gibson <david@gibson.dropbear.id.au> Fix memory leak in srcpos_verror()

Since dtc runs are short, we don't care that much about memory leaks.
Still, leaking the source position string every time we print an error
messages is pretty nasty. Fix it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
e19d3b1d6da33b78dec83a9064a1e9a570657dd6 01-Jan-2014 David Gibson <david@gibson.dropbear.id.au> Fix indentation of srcpos_verror()

Somehow this function ended up with a 7 space indent, instead of the usual
8 space (1 tab) indent.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
a1e6da8aed6b945802f851c8df229a264b6b3524 01-Jan-2014 David Gibson <david@gibson.dropbear.id.au> Fix typo in type of srcpos_verror() et al.

The srcpos_verror() and srcpos_error() functions declare the format
string as 'char const *' instead of 'const char *'. Fix it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
6efd9065e69ee39c45dc4113b3d212bc2757128a 01-Jan-2014 David Gibson <david@gibson.dropbear.id.au> Remove unused srcpos_warn() function

This function has no users, and we can replace it more generally later.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
17625371eeea2fa7257361163c52d336a1a98ebc 28-Oct-2013 David Gibson <david@gibson.dropbear.id.au> Use stdbool more widely

We already use the C99 bool type from stdbool.h in a few places. However
there are many other places we represent boolean values as plain ints.
This patch changes that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
8dec4d86ad3f44ef5011f86394d8f3061a09237a 16-Oct-2012 Michael Ellerman <michael@ellerman.id.au> dtc: srcpos_verror() should print to stderr

Errors should go to stderr.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
1b6d1941dc5b589632c254ee6e960404d7cef5f2 28-Sep-2012 Stephen Warren <swarren@nvidia.com> dtc: cpp co-existence: add support for #line directives

Line control directives of the following formats are supported:
#line LINE "FILE"
# LINE "FILE" [FLAGS]

This allows dtc to consume the output of pre-processors, and to provide
error messages that refer to the original filename, including taking
into account any #include directives that the pre-processor may have
performed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
de6b76240e91b9288cdce63ab81e51a7232d0927 15-Mar-2012 Simon Glass <sjg@chromium.org> dtc: Add -i option to support search paths

It is often inconvenient to place device tree files in the same directory
as their includes, or to specify the full path to include files.

An example of this is in U-Boot where we have a .dtsi file for each SOC
type, and this is included by the board .dts file. We need to either use
a mechanism like:

/include/ ARCH_CPU_DTS

with sed or cpp to perform the replacement with the correct path, or
we must specify the full path in the file:

/include/ "../../arch/arm/dts/tegra20.dtsi"

The first option is not desirable since it requires anyone compiling the
file to first pre-process it. The second is not desirable since it
introduces a path which is project-specific into a file which is supposed
to be a hardware description. For example Linux and U-Boot are unlikely to
put these include files in the same place.

It is much more convenient to specify the search patch on the command line
as is done with C pre-processors, for example.

Introduce a -i option to add to the list of search paths used to find
source and include files.

We cannot use -I as it is already in use. Other suggestions welcome.

Signed-off-by: Simon Glass <sjg@chromium.org>
/external/dtc/srcpos.c
69df9f0de25db1c37970850115cdf48335d41802 12-Jan-2012 Stephen Warren <swarren@nvidia.com> dtc: Implement -d option to write out a dependency file

This will allow callers to rebuild .dtb files when any of the /include/d
.dtsi files are modified, not just the top-level .dts file.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
c0fa2e6d4e59e62f2e9f23db1a2d94532fa4ae98 20-Oct-2010 John Bonesio <bones@secretlab.ca> Create new and use new print_error that uses printf style formatting.

yyerror is meant to be called by the parser internal code, and it's interface
is limited. Instead create and call a new error message routine that allows
formatted strings to be used.

yyerror uses the new routine so error formatting remains consistent.

Signed-of-by: John Bonesio <bones@secretlab.ca>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
/external/dtc/srcpos.c
c6225f86fd7fe2c46ba30203e0582900e2260f9c 08-Dec-2009 David Gibson <david@gibson.dropbear.id.au> dtc: Cleanup YYLTYPE and YYLLOC_DEFAULT declarations

This patch makes some small cleanups to the declaration of YYLTYPE,
YYLLOC_DEFAULT and related things.

- We used to use undocumented magic #defines for bison,
YYLTYPE_IS_DECLARED and YYLTYPE_IS_TRIVIAL. This may not be
portable across bison versions. Instead define YYLTYPE as a
macro in terms of struct srcpos, as the info pages suggest.

- Our kernel-derived coding style discourages typedefed
structures. So use 'struct srcpos' instead of 'srcpos'
throughout'.

- Indent the YYLLOC_DEFAULT macro according to our coding
style (it was in GNU indent style, since it was taken from
the example in the bison info).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
e1fee329e2a74141fc6872a5c4307d078c4ba553 08-Dec-2009 David Gibson <david@gibson.dropbear.id.au> dtc: Cleanup srcpos_string()

There are several small problems with the current srcpos_string().

- The code unnecessarily uses a temp buffer and two rounds of
*printf(); a single asprintf() will suffice.

- With previous changes, pos->file->name can never be NULL,
and the name field for a srcfile bound to stdin is already
set to something sensible.

- On allocation failure in asprintf() it returns a bogus
result, instead of causing a fatal error like every other
failed allocation.

- The format for representing file/line/column is gratuitously
different from the file/line format we used to use, and the
format used by gcc and bison.

This patch addresses all of these. There remains the problem that
asprintf() is not portable, but that can wait until another patch.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
728c5e87c655c17c2fbc1d5386b12ff328e0fc76 08-Dec-2009 David Gibson <david@gibson.dropbear.id.au> dtc: Cleanup line number tracking, add column number tracking

Our YYLTYPE current carries around first and last line and first and
last column information. However, of these, on the first line
information is actually filled in properly.

Furthermore, filling in the line number information from yylineno is
kind of clunky: we have to copy its value to the srcfile stack and
back to handle include file positioning correctly.

This patch cleans this up. We turn off flex's yylineno option and
instead track the line and column number ourselves from
YY_USER_ACTION. The line and column number are stored directly inside
the srcfile_state structure, so it's automatically a per-file
quantity. We now also fill in all the yylloc from YY_USER_ACTION.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
d68cb36b0bebc7711ada9b750f3c19398c44efb7 08-Dec-2009 David Gibson <david@gibson.dropbear.id.au> dtc: Simpler interface to source file management

This patch cleans up our handling of input files, particularly dts
source files, but also (to an extent) other input files such as those
used by /incbin/ and those used in -I dtb and -I fs modes.

We eliminate the current clunky mechanism which combines search paths
(which we don't actually use at present) with the open relative to
current source file behaviour, which we do.

Instead there's a single srcfile_relative_open() entry point for
callers which opens a new input file relative to the current source
file (which the srcpos code tracks internally). It doesn't currently
do search paths, but we can add that later without messing with the
callers, by drawing the search path from a global (which makes sense
anyway, rather than shuffling it around the rest of the processing
code).

That suffices for non-dts input files. For the actual dts files,
srcfile_push() and srcfile_pop() wrappers open the file while also
keeping track of it as the current source file for future opens.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
e5c8e1dcd7f2d3784194498e5ea916e7b48fe33a 12-Sep-2008 Jon Loeliger <jdl@jdl.com> Enhance source position implementation.

Implemented some print and copy routines.
Made empty srcpos objects that will be used later.
Protected .h file from multiple #include's.
Added srcpos_error() and srcpos_warn().

Signed-off-by: Jon Loeliger <jdl@freescale.com>
/external/dtc/srcpos.c
879e4d2590b50d63f82c3c3652bc3c7900591f1c 03-Oct-2008 Jon Loeliger <jdl@jdl.com> Implement and use an xstrdup() function

Many places in dtc use strdup(), but none of them actually check the
return value to see if the implied allocation succeeded. This is a
potential bug, which we fix in the patch below by replacing strdup()
with an xstrdup() which in analogy to xmalloc() will quit with a fatal
error if the allocation fails.

I felt the introduciton of util.[ch] was a better choice
for utility oriented code than directly using srcpos.c
for the new string function.

This patch is a re-factoring of Dave Gibson's similar patch.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
/external/dtc/srcpos.c
f7ea3708c38bd38851baafa83e98d95602e53cbc 05-Mar-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Make dtc_open_file() die() if unable to open requested file

All current callers of dtc_open_file() immediately die() if it returns
an error. In a non-interative tool like dtc, it's hard to see what
you could sensibly do to recover from a failure to open an input file
in any case.

Therefore, make dtc_open_file() itself die() if there's an error
opening the requested file. This removes the need for error checking
at the callsites, and ensures a consistent error message in all cases.
While we're at it, change the rror message from fstree.c when we fail
to open the input directory to match dtc_open_file()'s error message.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/srcpos.c
0f635df874540ee9ef5bf7137ca2a2d0cc5d807b 11-Jan-2008 Scott Wood <scottwood@freescale.com> Remove const from dtc_file::dir.

Signed-off-by: Scott Wood <scottwood@freescale.com>
/external/dtc/srcpos.c
42107f8bba994f718594dd670a937861d40f425d 07-Jan-2008 Scott Wood <scottwood@freescale.com> Convert malloc() uses to xmalloc().

Signed-off-by: Scott Wood <scottwood@freescale.com>
/external/dtc/srcpos.c
5695e99d5f6418f8f5b990bdcb1f153935d0fb06 04-Jan-2008 Scott Wood <scottwood@freescale.com> Handle absolute pathnames correctly in dtc_open_file.

Also, free file->dir when freeing file.

Signed-off-by: Scott Wood <scottwood@freescale.com>
/external/dtc/srcpos.c
910efac4b49f43cb1b66eef5aa0bbd020920bf2a 04-Jan-2008 Scott Wood <scottwood@freescale.com> Look for include files in the directory of the including file.

Looking in the diretory dtc is invoked from is not very useful behavior.

As part of the code reorganization to implement this, I removed the
uniquifying of name storage -- it seemed a rather dubious optimization
given likely usage, and some aspects of it would have been mildly awkward
to integrate with the new code.

Signed-off-by: Scott Wood <scottwood@freescale.com>
/external/dtc/srcpos.c
e45e6fd274826991c2b7e01fde4d73110487e0e0 23-Mar-2007 Jon Loeliger <jdl@freescale.com> DTC: Add support for a C-like #include "file" mechanism.

Keeps track of open files in a stack, and assigns
a filenum to source positions for each lexical token.
Modified error reporting to show source file as well.
No policy on file directory basis has been decided.
Still handles stdin.

Tested on all arch/powerpc/boot/dts DTS files

Signed-off-by: Jon Loeliger <jdl@freescale.com>
/external/dtc/srcpos.c