diff --git a/applets/pbot-vm/guest/lib/Languages/c2x.pm b/applets/pbot-vm/guest/lib/Languages/c2x.pm new file mode 100755 index 00000000..1dbcdb50 --- /dev/null +++ b/applets/pbot-vm/guest/lib/Languages/c2x.pm @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +# SPDX-FileCopyrightText: 2021 Pragmatic Software +# SPDX-License-Identifier: MIT + +use warnings; +use strict; + +package c2x; +use parent '_c_base'; + +1; diff --git a/applets/pbot-vm/guest/lib/Languages/clang2x.pm b/applets/pbot-vm/guest/lib/Languages/clang2x.pm new file mode 100755 index 00000000..f59ba286 --- /dev/null +++ b/applets/pbot-vm/guest/lib/Languages/clang2x.pm @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +# SPDX-FileCopyrightText: 2021 Pragmatic Software +# SPDX-License-Identifier: MIT + +use warnings; +use strict; + +package clang2x; +use parent '_c_base'; + +1; diff --git a/applets/pbot-vm/host/bin/vm-exec b/applets/pbot-vm/host/bin/vm-exec index e4eb0e2c..0327f4ee 100755 --- a/applets/pbot-vm/host/bin/vm-exec +++ b/applets/pbot-vm/host/bin/vm-exec @@ -219,7 +219,7 @@ sub configure_context($context, $config) { # set any undefined values to default values $context->{nick} //= 'vm'; $context->{channel} //= 'vm'; - $context->{lang} //= 'c11'; + $context->{lang} //= 'c2x'; $context->{'vm-serial'} //= SERIAL; $context->{'vm-cid'} //= CID; $context->{'vm-vport'} //= VPORT; diff --git a/applets/pbot-vm/host/lib/Languages/c2x.pm b/applets/pbot-vm/host/lib/Languages/c2x.pm new file mode 100755 index 00000000..95bfaa73 --- /dev/null +++ b/applets/pbot-vm/host/lib/Languages/c2x.pm @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +# SPDX-FileCopyrightText: 2021 Pragmatic Software +# SPDX-License-Identifier: MIT + +use warnings; +use strict; + +package Languages::c2x; +use parent 'Languages::_c_base'; + +sub initialize { + my ($self, %conf) = @_; + + $self->{sourcefile} = 'prog.c'; + $self->{execfile} = 'prog'; + $self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c2x -lm -Wfatal-errors -fsanitize=alignment,undefined -fsanitize-address-use-after-scope -fno-omit-frame-pointer'; + $self->{options_paste} = '-fdiagnostics-show-caret'; + $self->{options_nopaste} = '-fno-diagnostics-show-caret'; + $self->{cmdline} = 'gcc -gdwarf-2 -g3 $sourcefile $options -o $execfile'; + + $self->{prelude} = <<'END'; +#define _XOPEN_SOURCE 9001 +#define __USE_XOPEN + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +END +} + +1; diff --git a/applets/pbot-vm/host/lib/Languages/clang2x.pm b/applets/pbot-vm/host/lib/Languages/clang2x.pm new file mode 100755 index 00000000..6251b35e --- /dev/null +++ b/applets/pbot-vm/host/lib/Languages/clang2x.pm @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +# SPDX-FileCopyrightText: 2021 Pragmatic Software +# SPDX-License-Identifier: MIT + +use warnings; +use strict; + +package Languages::clang2x; +use parent 'Languages::_c_base'; + +sub initialize { + my ($self, %conf) = @_; + + $self->{sourcefile} = 'prog.c'; + $self->{execfile} = 'prog'; + $self->{default_options} = '-Wextra -Wall -Wno-unused -Wno-unused-parameter -pedantic -Wfloat-equal -Wshadow -std=c2x -lm -Wfatal-errors -fsanitize=integer,alignment,undefined -fsanitize-address-use-after-scope -fno-omit-frame-pointer'; + $self->{options_paste} = '-fdiagnostics-show-caret'; + $self->{options_nopaste} = '-fno-diagnostics-show-caret'; + $self->{cmdline} = 'clang -gdwarf-2 -g3 $sourcefile $options -o $execfile'; + + $self->{prelude} = <<'END'; +#define _XOPEN_SOURCE 9001 +#define __USE_XOPEN + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +END +} + +1;