1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00

Add pragma once tests

This commit is contained in:
cosineblast 2024-01-17 15:05:27 -03:00
parent 167c31c148
commit 30ff2bdc6b
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1 @@
pragma-once-sample.h

View File

@ -0,0 +1,21 @@
/*
** !!DESCRIPTION!! Simple #pragma once directive tests
** !!ORIGIN!! cc65 regression tests
** !!LICENCE!! Public Domain
*/
#ifdef FILE_INCLUDED
#error "This file should not have been included twice"
#define INCLUDED_TWICE
#else
#define FILE_INCLUDED
#endif
/* a pragma once directive should work regardless of where it is located in
the file, as long as it is seen by the preprocessor */
#pragma once

View File

@ -0,0 +1,27 @@
/*
** !!DESCRIPTION!! Simple #pragma once directive tests
** !!ORIGIN!! cc65 regression tests
** !!LICENCE!! Public Domain
*/
#include "pragma-once-sample.h"
#include "pragma-once-sample.h"
#include "pragma-once-sample-link.h"
/* pragma-once-sample-link.h is a symlink to pragma-once-sample. */
#include <stdio.h>
int main() {
#ifdef INCLUDED_TWICE
printf("pragma-once-sample.h included more than once\n");
return 1;
#else
printf("pragma-once-sample included once\n");
return 0;
#endif
}