]> git.gag.com Git - fw/sdcc/commitdiff
* src/SDCC.y: enabled compilation of empty source file
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 24 Nov 2006 20:01:34 +0000 (20:01 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 24 Nov 2006 20:01:34 +0000 (20:01 +0000)
* support/Util/SDCCerr.[ch]: added sdcc warning 190 -
  "ISO C forbids an empty source file"
* device/lib/_startup.c, device/lib/printf_tiny.c: disable warning 190
  if all the code is ifdefed out.

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4483 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/lib/_startup.c
device/lib/printf_tiny.c
src/SDCC.y
support/Util/SDCCerr.c
support/Util/SDCCerr.h

index ab2d4d58cc6a4e5d0f8a9fc7f1d63de4ee2d9c33..0f9995d9ce44a3922addcf58e222f09ad57f7588 100644 (file)
@@ -1,5 +1,5 @@
 /*-------------------------------------------------------------------------
-  _startup.c - startup routine for sdcc 
+  _startup.c - startup routine for sdcc
 
              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)
 
@@ -7,19 +7,19 @@
    under the terms of the GNU Library General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
-   
+
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Library General Public License for more details.
-   
+
    You should have received a copy of the GNU Library General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
+
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
+   what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
 /* External startup code can be written in C
@@ -34,5 +34,9 @@ unsigned char _sdcc_external_startup ()
     return 0;
 }
 
-#endif
+#else
+
+/* Disable "ISO C forbids an empty source file" wraning message */
+#pragma disable_warning 190
 
+#endif
index 46ef05fbd911b997dd713d888066a2afa5c80972..4d8543854f643a5d7b31b69d538056f6e4f9ef34 100644 (file)
@@ -22,7 +22,7 @@
  * interrupt routine).  Code size is under 270 bytes.  Only one library
  * function is called (_gptrget, 41 bytes), in addition to calls to
  * putchar().
- * 
+ *
  * Five simple formats are supported
  *
  *     %d      signed 16 bit integer decimal (-32768 to 32767)
@@ -33,7 +33,7 @@
  *
  * For a more complete printf that supports longs, floating point and
  * field width, try using printf_fast() or printf_large().
- */    
+ */
 
 
 // This removes the negative number code, causing "%d" to be the same
@@ -61,6 +61,9 @@
 #warning "printf_tiny not built, does not support --xstack"
 #elif defined(_SDCC_NO_ASM_LIB_FUNCS)
 #warning "printf_tiny not built, _SDCC_NO_ASM_LIB_FUNCS defined"
+#else
+/* Disable "ISO C forbids an empty source file" wraning message */
+#pragma disable_warning 190
 #endif
 #else // defines are compatible with printf_tiny
 
index 49788ecbfeb77e32a89ef36ceae48b7937138d5b..db10859269d4de5f48698d366834f8d22adbe291 100644 (file)
@@ -133,8 +133,16 @@ bool uselessDecl = TRUE;
 %%
 
 file
+   : /* empty */
+        { if (!options.lessPedantic)
+                   werror(W_EMPTY_SOURCE_FILE);
+        }
+   | program
+   ;
+
+program
    : external_definition       
-   | file external_definition
+   | program external_definition
    ;
 
 external_definition
index 6839b417bde682f632b2dd0904050dd297c2dfc3..082400256f80cd2b4cffdba176a8aa1867518600 100644 (file)
@@ -432,6 +432,8 @@ struct
    "flexible array member not at end of struct" },
 { E_FLEXARRAY_INEMPTYSTRCT, ERROR_LEVEL_ERROR,
    "flexible array in otherwise empty struct" },
+{ W_EMPTY_SOURCE_FILE, ERROR_LEVEL_WARNING,
+   "ISO C forbids an empty source file" },
 };
 
 /*
index c1e357eeab9aca42f56afe46b4e0864ef1df6085..927998ccc717d9e91a9dc1f5472e60335266a3ef 100644 (file)
@@ -205,6 +205,7 @@ SDCCERR - SDCC Standard error handler
 #define W_C89_NO_FLEXARRAY            187 /* ISO C90 does not support flexible array members */
 #define E_FLEXARRAY_NOTATEND          188 /* flexible array member not at end of struct */
 #define E_FLEXARRAY_INEMPTYSTRCT      189 /* flexible array in otherwise empty struct */
+#define W_EMPTY_SOURCE_FILE           190 /* ISO C forbids an empty source file */
 
 #define MAX_ERROR_WARNING             256 /* size of disable warnings array */