diff options
author | Stefan Kempf <stefan@cvs.openbsd.org> | 2007-11-10 22:14:16 +0000 |
---|---|---|
committer | Stefan Kempf <stefan@cvs.openbsd.org> | 2007-11-10 22:14:16 +0000 |
commit | b67ed6881ae3304c514e9faa296f0d83f3519ac2 (patch) | |
tree | 249d6c44d7de4d529ea67582be4cb28dc0efe149 /usr.bin | |
parent | c2c4f740efb53d8e3a2c87779660764a71a49dc0 (diff) |
Pull from master repo:
++ and -- are not allowed in preprocessor expressions. Based on a
diff by Jan Kryl.
ok ragge@, otto@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pcc/cpp/scanner.l | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/pcc/cpp/scanner.l b/usr.bin/pcc/cpp/scanner.l index 035127fb0fb..bf615db40f2 100644 --- a/usr.bin/pcc/cpp/scanner.l +++ b/usr.bin/pcc/cpp/scanner.l @@ -1,5 +1,5 @@ %{ -/* $Id: scanner.l,v 1.4 2007/10/27 12:50:50 ragge Exp $ */ +/* $OpenBSD: scanner.l,v 1.5 2007/11/10 22:14:15 stefan Exp $ */ /* * Copyright (c) 2004 Anders Magnusson. All rights reserved. @@ -51,6 +51,7 @@ static void undefstmt(void); static void cpperror(void); static void elifstmt(void); static void storepb(void); +static void badop(const char *); void include(void); void define(void); @@ -138,6 +139,8 @@ WS [\t ] "\r" { ; /* Ignore CR's */ } +<IFR>"++" { badop("++"); } +<IFR>"--" { badop("--"); } <IFR>"==" { return EQ; } <IFR>"!=" { return NE; } <IFR>"<=" { return LE; } @@ -828,3 +831,9 @@ pragmastmt(void) prtline(); slow = 0; } + +static void +badop(const char *op) +{ + error("invalid operator in preprocessor expression: %s", op); +} |