summaryrefslogtreecommitdiff
path: root/utils/hp2ps/HpFile.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix uninformative hp2ps error when the cmdline contains double quotesZejun Wu2018-12-111-20/+17
| | | | | | | | | | | | | | | | | | | | | | | Reapply D5346 with fix incompatible shell quoting in tests. It seems like `$'string'` is not recognized under all test environments, so let's avoid it in tests. Test Plan: ``` hp2ps: "T15904".hp, line 2: integer must follow identifier ``` use new ghc and hp2ps to profile a simple program. Reviewers: simonmar, bgamari, erikd, tdammers Reviewed By: bgamari Subscribers: tdammers, carter, rwbarton GHC Trac Issues: #15904 Differential Revision: https://phabricator.haskell.org/D5388
* cosmetic change: expandtab in utils/hp2ps/HpFile.cZejun Wu2018-12-111-202/+202
| | | | | | | | | | | | | | | | | rGHCbba2b9bf2d69700dc114118658507aaac34c5e62 expand tabs in utils/hp2ps/HpFile.c with tabwidth 2, but the code was written as tabwidth 8. This change simply retabs the code with tabwidth 8 and removes trailing spaces. Test Plan: Tested in stacked diff: {D5388} Reviewers: simonmar, bgamari, afarmer, tdammers Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5407
* Revert "Fix uninformative hp2ps error when the cmdline contains double quotes"Ben Gamari2018-11-241-174/+177
| | | | This reverts commit 390df8b51b917fb6409cbde8e73fe838d61d8832.
* Fix uninformative hp2ps error when the cmdline contains double quotesZejun Wu2018-11-221-68/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The format of hp file didn't allow double quotes inside strings, and under prof build, we include args in JOB, which may have double quotes. When this happens, the error message is confusing to the user. This can also happen under normal build if the executable name contains double quite, which is unlikely though. We fix this issue by introducing escaping for double quotes inside a string by repeating it twice. We also fix a buffer overflow bug when the length of the string happen to be multiple of 5000. Test Plan: new tests, which used to fail with error message: ``` hp2ps: "T15904".hp, line 2: integer must follow identifier ``` use new ghc and hp2ps to profile a simple program. Reviewers: simonmar, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15904 Differential Revision: https://phabricator.haskell.org/D5346
* Prefer #if defined to #ifdefBen Gamari2017-04-281-1/+1
| | | | Our new CPP linter enforces this.
* hp2ps: mark local functions as 'static'Sergei Trofimovich2016-02-071-1/+3
| | | | | | | | | | | | | | | | | | Found by uselex.rb: fonttab: [R]: exported from: ./utils/hp2ps/dist/build/Dimensions.o GetString: [R]: exported from: ./utils/hp2ps/dist/build/HpFile.o thestring: [R]: exported from: ./utils/hp2ps/dist/build/HpFile.o auxfp: [R]: exported from: ./utils/hp2ps/dist/build/Main.o dflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o filter: [R]: exported from: ./utils/hp2ps/dist/build/Main.o iflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o mflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o pflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o psfile: [R]: exported from: ./utils/hp2ps/dist/build/Main.o tflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o OrderOf: [R]: exported from: ./utils/hp2ps/dist/build/Reorder.o Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* Fix identifier parsing in hp2psYuras Shumovich2015-08-291-21/+23
| | | | | | | | | | | | | | | | | Now identifiers can start with a package key, which is a hash, so they may also start with a digit. Identifiers always appear at the beginning of a line, and numbers never appear here, soit's safe to allow identifiers to start with a digit. Test Plan: `concprog002` passes under `threaded2_hT` way Reviewers: austin, bgamari, thomie Reviewed By: austin, bgamari, thomie Differential Revision: https://phabricator.haskell.org/D1175 GHC Trac Issues: #10661
* Add a cast to new code in hp2psReid Barton2014-06-301-1/+1
| | | | | For parallelism with the existing code. I don't think it should make any difference.
* Avoid integer overflow in hp2ps (#9145)Reid Barton2014-06-301-3/+8
| | | | | This is slightly hackish, but hp2ps is already convoluted enough that I don't feel bad about it.
* Fix memleak in hp2psNicolas Trangez2014-04-271-0/+2
| | | | | | Issue discovered by Coverity scan, CID 43167. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix potential out-of-bound memory accessNicolas Trangez2014-04-271-2/+2
| | | | | | Issue discovered by Coverity scan, CID 43165. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Remove some antiquated C constructsIan Lynagh2011-08-011-26/+14
| | | | | | | | Fixes validate on amd64/Linux with: SRC_CC_OPTS += -Wmissing-parameter-type SRC_CC_OPTS += -Wold-style-declaration SRC_CC_OPTS += -Wold-style-definition
* Detect EOF when trying to parse a string in hp2psIan Lynagh2010-05-061-1/+4
|
* Fix hp2ps when the .hp file has large string literalsIan Lynagh2010-05-051-4/+13
|
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+587
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.